Implementation note. This implementation maintains stamped references by creating internal objects representing "boxed" [reference, integer] pairs.
| Constructor Summary |
|---|
|
Creates a new AtomicStampedReference with the given initial values. |
| Method Summary | |
|---|---|
| boolean |
Atomically sets the value of the stamp to the given update value if the current reference is == to the expected reference. |
| boolean |
Atomically sets the value of both the reference and stamp to the given update values if the current reference is == to the expected reference and the current stamp is equal to the expected stamp. |
| V |
Returns the current values of both the reference and the stamp. |
| V |
Returns the current value of the reference. |
| int |
Returns the current value of the stamp. |
| void |
Unconditionally sets the value of both the reference and stamp. |
| boolean |
Atomically sets the value of both the reference and stamp to the given update values if the current reference is == to the expected reference and the current stamp is equal to the expected stamp. |
| Methods inherited from java.langObject |
|---|
public AtomicStampedReference
(
V
initialRef,
int
initialStamp
)
public
boolean
attemptStamp
(
V
expectedReference,
int
newStamp
)
public
boolean
compareAndSet
(
V
expectedReference,
V
newReference,
int
expectedStamp,
int
newStamp
)
public
V
get
(
int
[]
stampHolder
)
public
V
getReference
(
)
public
int
getStamp
(
)
public
void
set
(
V
newReference,
int
newStamp
)
public
boolean
weakCompareAndSet
(
V
expectedReference,
V
newReference,
int
expectedStamp,
int
newStamp
)
May fail spuriously and does not provide ordering guarantees, so is only rarely an appropriate alternative to compareAndSet .