Liking cljdoc? Tell your friends :D

jdk.util.concurrent.atomic.AtomicIntegerFieldUpdater

A reflection-based utility that enables atomic updates to designated volatile int fields of designated classes. This class is designed for use in atomic data structures in which several fields of the same node are independently subject to atomic updates.

Note that the guarantees of the compareAndSet method in this class are weaker than in other atomic classes. Because this class cannot ensure that all uses of the field are appropriate for purposes of atomic access, it can guarantee atomicity only with respect to other invocations of compareAndSet and set on the same updater.

A reflection-based utility that enables atomic updates to
designated volatile int fields of designated classes.
This class is designed for use in atomic data structures in which
several fields of the same node are independently subject to atomic
updates.

Note that the guarantees of the compareAndSet
method in this class are weaker than in other atomic classes.
Because this class cannot ensure that all uses of the field
are appropriate for purposes of atomic access, it can
guarantee atomicity only with respect to other invocations of
compareAndSet and set on the same updater.
raw docstring

*new-updaterclj

(*new-updater tclass field-name)

Creates and returns an updater for objects with the given field. The Class argument is needed to check that reflective types and generic types match.

tclass - the class of the objects holding the field - java.lang.Class field-name - the name of the field to be updated - java.lang.String

returns: the updater - <U> java.util.concurrent.atomic.AtomicIntegerFieldUpdater<U>

throws: java.lang.IllegalArgumentException - if the field is not a volatile integer type

Creates and returns an updater for objects with the given field.
 The Class argument is needed to check that reflective types and
 generic types match.

tclass - the class of the objects holding the field - `java.lang.Class`
field-name - the name of the field to be updated - `java.lang.String`

returns: the updater - `<U> java.util.concurrent.atomic.AtomicIntegerFieldUpdater<U>`

throws: java.lang.IllegalArgumentException - if the field is not a volatile integer type
raw docstring

accumulate-and-getclj

(accumulate-and-get this obj x accumulator-function)

Atomically updates the field of the given object managed by this updater with the results of applying the given function to the current and given values, returning the updated value. The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads. The function is applied with the current value as its first argument, and the given update as the second argument.

obj - An object whose field to get and set - T x - the update value - int accumulator-function - a side-effect-free function of two arguments - java.util.function.IntBinaryOperator

returns: the updated value - int

Atomically updates the field of the given object managed by this
 updater with the results of applying the given function to the
 current and given values, returning the updated value. The
 function should be side-effect-free, since it may be re-applied
 when attempted updates fail due to contention among threads.  The
 function is applied with the current value as its first argument,
 and the given update as the second argument.

obj - An object whose field to get and set - `T`
x - the update value - `int`
accumulator-function - a side-effect-free function of two arguments - `java.util.function.IntBinaryOperator`

returns: the updated value - `int`
raw docstring

add-and-getclj

(add-and-get this obj delta)

Atomically adds the given value to the current value of the field of the given object managed by this updater.

obj - An object whose field to get and set - T delta - the value to add - int

returns: the updated value - int

Atomically adds the given value to the current value of the field of
 the given object managed by this updater.

obj - An object whose field to get and set - `T`
delta - the value to add - `int`

returns: the updated value - `int`
raw docstring

compare-and-setclj

(compare-and-set this obj expect update)

Atomically sets the field of the given object managed by this updater to the given updated value if the current value == the expected value. This method is guaranteed to be atomic with respect to other calls to compareAndSet and set, but not necessarily with respect to other changes in the field.

obj - An object whose field to conditionally set - T expect - the expected value - int update - the new value - int

returns: true if successful - boolean

throws: java.lang.ClassCastException - if obj is not an instance of the class possessing the field established in the constructor

Atomically sets the field of the given object managed by this updater
 to the given updated value if the current value == the
 expected value. This method is guaranteed to be atomic with respect to
 other calls to compareAndSet and set, but not
 necessarily with respect to other changes in the field.

obj - An object whose field to conditionally set - `T`
expect - the expected value - `int`
update - the new value - `int`

returns: true if successful - `boolean`

throws: java.lang.ClassCastException - if obj is not an instance of the class possessing the field established in the constructor
raw docstring

decrement-and-getclj

(decrement-and-get this obj)

Atomically decrements by one the current value of the field of the given object managed by this updater.

obj - An object whose field to get and set - T

returns: the updated value - int

Atomically decrements by one the current value of the field of the
 given object managed by this updater.

obj - An object whose field to get and set - `T`

returns: the updated value - `int`
raw docstring

getclj

(get this obj)

Gets the current value held in the field of the given object managed by this updater.

obj - An object whose field to get - T

returns: the current value - int

Gets the current value held in the field of the given object managed
 by this updater.

obj - An object whose field to get - `T`

returns: the current value - `int`
raw docstring

get-and-accumulateclj

(get-and-accumulate this obj x accumulator-function)

Atomically updates the field of the given object managed by this updater with the results of applying the given function to the current and given values, returning the previous value. The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads. The function is applied with the current value as its first argument, and the given update as the second argument.

obj - An object whose field to get and set - T x - the update value - int accumulator-function - a side-effect-free function of two arguments - java.util.function.IntBinaryOperator

returns: the previous value - int

Atomically updates the field of the given object managed by this
 updater with the results of applying the given function to the
 current and given values, returning the previous value. The
 function should be side-effect-free, since it may be re-applied
 when attempted updates fail due to contention among threads.  The
 function is applied with the current value as its first argument,
 and the given update as the second argument.

obj - An object whose field to get and set - `T`
x - the update value - `int`
accumulator-function - a side-effect-free function of two arguments - `java.util.function.IntBinaryOperator`

returns: the previous value - `int`
raw docstring

get-and-addclj

(get-and-add this obj delta)

Atomically adds the given value to the current value of the field of the given object managed by this updater.

obj - An object whose field to get and set - T delta - the value to add - int

returns: the previous value - int

Atomically adds the given value to the current value of the field of
 the given object managed by this updater.

obj - An object whose field to get and set - `T`
delta - the value to add - `int`

returns: the previous value - `int`
raw docstring

get-and-decrementclj

(get-and-decrement this obj)

Atomically decrements by one the current value of the field of the given object managed by this updater.

obj - An object whose field to get and set - T

returns: the previous value - int

Atomically decrements by one the current value of the field of the
 given object managed by this updater.

obj - An object whose field to get and set - `T`

returns: the previous value - `int`
raw docstring

get-and-incrementclj

(get-and-increment this obj)

Atomically increments by one the current value of the field of the given object managed by this updater.

obj - An object whose field to get and set - T

returns: the previous value - int

Atomically increments by one the current value of the field of the
 given object managed by this updater.

obj - An object whose field to get and set - `T`

returns: the previous value - `int`
raw docstring

get-and-setclj

(get-and-set this obj new-value)

Atomically sets the field of the given object managed by this updater to the given value and returns the old value.

obj - An object whose field to get and set - T new-value - the new value - int

returns: the previous value - int

Atomically sets the field of the given object managed by this updater
 to the given value and returns the old value.

obj - An object whose field to get and set - `T`
new-value - the new value - `int`

returns: the previous value - `int`
raw docstring

get-and-updateclj

(get-and-update this obj update-function)

Atomically updates the field of the given object managed by this updater with the results of applying the given function, returning the previous value. The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads.

obj - An object whose field to get and set - T update-function - a side-effect-free function - java.util.function.IntUnaryOperator

returns: the previous value - int

Atomically updates the field of the given object managed by this updater
 with the results of applying the given function, returning the previous
 value. The function should be side-effect-free, since it may be
 re-applied when attempted updates fail due to contention among threads.

obj - An object whose field to get and set - `T`
update-function - a side-effect-free function - `java.util.function.IntUnaryOperator`

returns: the previous value - `int`
raw docstring

increment-and-getclj

(increment-and-get this obj)

Atomically increments by one the current value of the field of the given object managed by this updater.

obj - An object whose field to get and set - T

returns: the updated value - int

Atomically increments by one the current value of the field of the
 given object managed by this updater.

obj - An object whose field to get and set - `T`

returns: the updated value - `int`
raw docstring

lazy-setclj

(lazy-set this obj new-value)

Eventually sets the field of the given object managed by this updater to the given updated value.

obj - An object whose field to set - T new-value - the new value - int

Eventually sets the field of the given object managed by this
 updater to the given updated value.

obj - An object whose field to set - `T`
new-value - the new value - `int`
raw docstring

setclj

(set this obj new-value)

Sets the field of the given object managed by this updater to the given updated value. This operation is guaranteed to act as a volatile store with respect to subsequent invocations of compareAndSet.

obj - An object whose field to set - T new-value - the new value - int

Sets the field of the given object managed by this updater to the
 given updated value. This operation is guaranteed to act as a volatile
 store with respect to subsequent invocations of compareAndSet.

obj - An object whose field to set - `T`
new-value - the new value - `int`
raw docstring

update-and-getclj

(update-and-get this obj update-function)

Atomically updates the field of the given object managed by this updater with the results of applying the given function, returning the updated value. The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads.

obj - An object whose field to get and set - T update-function - a side-effect-free function - java.util.function.IntUnaryOperator

returns: the updated value - int

Atomically updates the field of the given object managed by this updater
 with the results of applying the given function, returning the updated
 value. The function should be side-effect-free, since it may be
 re-applied when attempted updates fail due to contention among threads.

obj - An object whose field to get and set - `T`
update-function - a side-effect-free function - `java.util.function.IntUnaryOperator`

returns: the updated value - `int`
raw docstring

weak-compare-and-setclj

(weak-compare-and-set this obj expect update)

Atomically sets the field of the given object managed by this updater to the given updated value if the current value == the expected value. This method is guaranteed to be atomic with respect to other calls to compareAndSet and set, but not necessarily with respect to other changes in the field.

May fail spuriously and does not provide ordering guarantees, so is only rarely an appropriate alternative to compareAndSet.

obj - An object whose field to conditionally set - T expect - the expected value - int update - the new value - int

returns: true if successful - boolean

throws: java.lang.ClassCastException - if obj is not an instance of the class possessing the field established in the constructor

Atomically sets the field of the given object managed by this updater
 to the given updated value if the current value == the
 expected value. This method is guaranteed to be atomic with respect to
 other calls to compareAndSet and set, but not
 necessarily with respect to other changes in the field.

 May fail
 spuriously and does not provide ordering guarantees, so is
 only rarely an appropriate alternative to compareAndSet.

obj - An object whose field to conditionally set - `T`
expect - the expected value - `int`
update - the new value - `int`

returns: true if successful - `boolean`

throws: java.lang.ClassCastException - if obj is not an instance of the class possessing the field established in the constructor
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close