1 *java.util.concurrent.atomic.AtomicReference* *AtomicReference* An object refere
3 public class AtomicReference
4 extends |java.lang.Object|
5 implements |java.io.Serializable|
7 |java.util.concurrent.atomic.AtomicReference_Description|
8 |java.util.concurrent.atomic.AtomicReference_Fields|
9 |java.util.concurrent.atomic.AtomicReference_Constructors|
10 |java.util.concurrent.atomic.AtomicReference_Methods|
12 ================================================================================
14 *java.util.concurrent.atomic.AtomicReference_Constructors*
15 |java.util.concurrent.atomic.AtomicReference()|Create a new AtomicReference wit
16 |java.util.concurrent.atomic.AtomicReference(V)|Create a new AtomicReference wi
18 *java.util.concurrent.atomic.AtomicReference_Methods*
19 |java.util.concurrent.atomic.AtomicReference.compareAndSet(V,V)|Atomically set
20 |java.util.concurrent.atomic.AtomicReference.get()|Get the current value.
21 |java.util.concurrent.atomic.AtomicReference.getAndSet(V)|Set to the given valu
22 |java.util.concurrent.atomic.AtomicReference.set(V)|Set to the given value.
23 |java.util.concurrent.atomic.AtomicReference.toString()|Returns the String repr
24 |java.util.concurrent.atomic.AtomicReference.weakCompareAndSet(V,V)|Atomically
26 *java.util.concurrent.atomic.AtomicReference_Description*
28 An object reference that may be updated atomically. See the
29 (|java.util.concurrent.atomic|) package specification for description of the
30 properties of atomic variables.
33 *java.util.concurrent.atomic.AtomicReference()*
35 public AtomicReference()
37 Create a new AtomicReference with null initial value.
40 *java.util.concurrent.atomic.AtomicReference(V)*
42 public AtomicReference(java.lang.Object initialValue)
44 Create a new AtomicReference with the given initial value.
46 initialValue - the initial value
48 *java.util.concurrent.atomic.AtomicReference.compareAndSet(V,V)*
50 public final boolean compareAndSet(
51 java.lang.Object expect,
52 java.lang.Object update)
54 Atomically set the value to the given updated value if the current value == the
57 expect - the expected value
58 update - the new value
60 Returns: true if successful. False return indicates that the actual value was not equal
61 to the expected value.
62 *java.util.concurrent.atomic.AtomicReference.get()*
64 public final |java.lang.Object| get()
66 Get the current value.
69 Returns: the current value
70 *java.util.concurrent.atomic.AtomicReference.getAndSet(V)*
72 public final |java.lang.Object| getAndSet(java.lang.Object newValue)
74 Set to the given value and return the old value.
76 newValue - the new value
78 Returns: the previous value
79 *java.util.concurrent.atomic.AtomicReference.set(V)*
81 public final void set(java.lang.Object newValue)
83 Set to the given value.
85 newValue - the new value
87 *java.util.concurrent.atomic.AtomicReference.toString()*
89 public |java.lang.String| toString()
91 Returns the String representation of the current value.
94 Returns: the String representation of the current value.
95 *java.util.concurrent.atomic.AtomicReference.weakCompareAndSet(V,V)*
97 public final boolean weakCompareAndSet(
98 java.lang.Object expect,
99 java.lang.Object update)
101 Atomically set the value to the given updated value if the current value == the
102 expected value. May fail spuriously.
104 expect - the expected value
105 update - the new value
107 Returns: true if successful.