public class ResettableLazyReference<T> extends Object
getOrCreate(Supplier)The reference can be cleared atomically with
safeReset(Object). Once reset, no other thread is able obtain the same value from this reference (though other threads may already have obtained it before the reset occurred).
|Constructor and Description|
|Modifier and Type||Method and Description|
Gets the reference's value, obtaining the new value from the supplier if it was not previously initialized.
Resets this reference to empty, returning the old value.
Compares the reference value to the
public io.atlassian.fugue.Option<T> reset()
expectedvalue and resets it if and only if it is identical.
The reset request will fail (return
Option.none() and have no effect) if the
value supplied is
expected- the expected value of the reference
nullor because it did not match the value currently held by the reference), then
public io.atlassian.fugue.Option<T> get()
Option.someon the current value for this reference;
Option.none()if it has not been initialized yet
Only one thread will be allowed to call the supplier at any given time, and it will not be
called again before the reference is
Copyright © 2002-2021 Atlassian. All Rights Reserved.