1 *java.util.concurrent.atomic.AtomicLongFieldUpdater* *AtomicLongFieldUpdater* A
3 public abstract class AtomicLongFieldUpdater
4 extends |java.lang.Object|
6 |java.util.concurrent.atomic.AtomicLongFieldUpdater_Description|
7 |java.util.concurrent.atomic.AtomicLongFieldUpdater_Fields|
8 |java.util.concurrent.atomic.AtomicLongFieldUpdater_Constructors|
9 |java.util.concurrent.atomic.AtomicLongFieldUpdater_Methods|
11 ================================================================================
13 *java.util.concurrent.atomic.AtomicLongFieldUpdater_Constructors*
14 |java.util.concurrent.atomic.AtomicLongFieldUpdater()|Protected do-nothing cons
16 *java.util.concurrent.atomic.AtomicLongFieldUpdater_Methods*
17 |java.util.concurrent.atomic.AtomicLongFieldUpdater.addAndGet(T,long)|Atomicall
18 |java.util.concurrent.atomic.AtomicLongFieldUpdater.compareAndSet(T,long,long)|
19 |java.util.concurrent.atomic.AtomicLongFieldUpdater.decrementAndGet(T)|Atomical
20 |java.util.concurrent.atomic.AtomicLongFieldUpdater.get(T)|Get the current valu
21 |java.util.concurrent.atomic.AtomicLongFieldUpdater.getAndAdd(T,long)|Atomicall
22 |java.util.concurrent.atomic.AtomicLongFieldUpdater.getAndDecrement(T)|Atomical
23 |java.util.concurrent.atomic.AtomicLongFieldUpdater.getAndIncrement(T)|Atomical
24 |java.util.concurrent.atomic.AtomicLongFieldUpdater.getAndSet(T,long)|Set to th
25 |java.util.concurrent.atomic.AtomicLongFieldUpdater.incrementAndGet(T)|Atomical
26 |java.util.concurrent.atomic.AtomicLongFieldUpdater.newUpdater(Class,String)|Cr
27 |java.util.concurrent.atomic.AtomicLongFieldUpdater.set(T,long)|Set the field o
28 |java.util.concurrent.atomic.AtomicLongFieldUpdater.weakCompareAndSet(T,long,long)|
30 *java.util.concurrent.atomic.AtomicLongFieldUpdater_Description*
32 A reflection-based utility that enables atomic updates to designated volatile
33 long fields of designated classes. This class is designed for use in atomic
34 data structures in which several fields of the same node are independently
35 subject to atomic updates.
37 Note that the guarantees of the compareAndSet method in this class are weaker
38 than in other atomic classes. Because this class cannot ensure that all uses of
39 the field are appropriate for purposes of atomic access, it can guarantee
40 atomicity and volatile semantics only with respect to other invocations of
41 compareAndSet and set.
44 *java.util.concurrent.atomic.AtomicLongFieldUpdater()*
46 protected AtomicLongFieldUpdater()
48 Protected do-nothing constructor for use by subclasses.
51 *java.util.concurrent.atomic.AtomicLongFieldUpdater.addAndGet(T,long)*
53 public long addAndGet(
57 Atomically add the given value to current value.
59 obj - An object whose field to get and set
60 delta - the value to add
62 Returns: the updated value;
63 *java.util.concurrent.atomic.AtomicLongFieldUpdater.compareAndSet(T,long,long)*
65 public abstract boolean compareAndSet(
70 Atomically set the value of the field of the given object managed by this
71 Updater to the given updated value if the current value == the expected value.
72 This method is guaranteed to be atomic with respect to other calls to
73 compareAndSet and set, but not necessarily with respect to other changes in the
76 obj - An object whose field to conditionally set
77 expect - the expected value
78 update - the new value
80 Returns: true if successful.
81 *java.util.concurrent.atomic.AtomicLongFieldUpdater.decrementAndGet(T)*
83 public long decrementAndGet(java.lang.Object obj)
85 Atomically decrement by one the current value.
87 obj - An object whose field to get and set
89 Returns: the updated value;
90 *java.util.concurrent.atomic.AtomicLongFieldUpdater.get(T)*
92 public abstract long get(java.lang.Object obj)
94 Get the current value held in the field by the given object.
96 obj - An object whose field to get
98 Returns: the current value
99 *java.util.concurrent.atomic.AtomicLongFieldUpdater.getAndAdd(T,long)*
101 public long getAndAdd(
102 java.lang.Object obj,
105 Atomically add the given value to current value.
107 obj - An object whose field to get and set
108 delta - the value to add
110 Returns: the previous value;
111 *java.util.concurrent.atomic.AtomicLongFieldUpdater.getAndDecrement(T)*
113 public long getAndDecrement(java.lang.Object obj)
115 Atomically decrement by one the current value.
117 obj - An object whose field to get and set
119 Returns: the previous value;
120 *java.util.concurrent.atomic.AtomicLongFieldUpdater.getAndIncrement(T)*
122 public long getAndIncrement(java.lang.Object obj)
124 Atomically increment by one the current value.
126 obj - An object whose field to get and set
128 Returns: the previous value;
129 *java.util.concurrent.atomic.AtomicLongFieldUpdater.getAndSet(T,long)*
131 public long getAndSet(
132 java.lang.Object obj,
135 Set to the given value and return the old value.
137 obj - An object whose field to get and set
138 newValue - the new value
140 Returns: the previous value
141 *java.util.concurrent.atomic.AtomicLongFieldUpdater.incrementAndGet(T)*
143 public long incrementAndGet(java.lang.Object obj)
145 Atomically increment by one the current value.
147 obj - An object whose field to get and set
149 Returns: the updated value;
150 *java.util.concurrent.atomic.AtomicLongFieldUpdater.newUpdater(Class,String)*
152 public static |java.util.concurrent.atomic.AtomicLongFieldUpdater| newUpdater(
153 java.lang.Class tclass,
154 java.lang.String fieldName)
156 Creates an updater for objects with the given field. The Class argument is
157 needed to check that reflective types and generic types match.
159 tclass - the class of the objects holding the field
160 fieldName - the name of the field to be updated.
163 *java.util.concurrent.atomic.AtomicLongFieldUpdater.set(T,long)*
165 public abstract void set(
166 java.lang.Object obj,
169 Set the field of the given object managed by this updater. This operation is
170 guaranteed to act as a volatile store with respect to subsequent invocations of
173 obj - An object whose field to set
174 newValue - the new value
176 *java.util.concurrent.atomic.AtomicLongFieldUpdater.weakCompareAndSet(T,long,long)*
178 public abstract boolean weakCompareAndSet(
179 java.lang.Object obj,
183 Atomically set the value of the field of the given object managed by this
184 Updater to the given updated value if the current value == the expected value.
185 This method is guaranteed to be atomic with respect to other calls to
186 compareAndSet and set, but not necessarily with respect to other changes in the
187 field, and may fail spuriously.
189 obj - An object whose field to conditionally set
190 expect - the expected value
191 update - the new value
193 Returns: true if successful.