AtomicVariable

Class

The {@var} atomic variable handler in memory. This class provides the reference object, and also the wrapping/unwrapping points.

This should rarely be used by syntax or third-party API - atomics are handled internally. Unless explicitly asked for by a method (such as with an AtomicVariable parameter) the atomic will always be unwrapped before a call.

Extends

AtomicReference

Modifiers

public

Constructors


new AtomicVariable ()

Constructor
No description is available for this element.
Return Type

AtomicVariable

Modifiers

public


Methods


add (Object, Object)

Method
No description is available for this element.
IndexTypeName
1Objectvalue
2Objectatomic
Return Type

void

Modifiers

public static

remove (Object, Object)

Method
No description is available for this element.
IndexTypeName
1Objectvalue
2Objectatomic
Return Type

void

Modifiers

public static

get (Object)

Method

Unwraps the atomic reference, respecting atomic access. This is thread-safe.

IndexTypeName
1Objectatomic
Return Type

Object

Modifiers

public static

wrap (Object)

Method

Returns the atomic-wrapped version of this object. If it is already atomic, nothing will be done to it.

If the value is null a new AtomicVariable will be returned.

IndexTypeName
1Objectobject
Return Type

AtomicVariable

Modifiers

public static

// Randomly-generated example
final AtomicVariable variable = AtomicVariable.wrap(object);
assert variable.add(value, atomic) == null;
assert variable.remove(value, atomic) == null;
variable.get(atomic);

set (Object, Object)

Method

Sets the atomic reference to the given value.

If the holder is not atomic, this will throw an error.

IndexTypeName
1Objectvalue
2Objectatomic
Return Type

void

Modifiers

public static

delete (Object)

Method

Empties the atomic reference.

If the holder is not atomic, this will throw an error.

IndexTypeName
1Objectatomic
Return Type

void

Modifiers

public static

unwrap (Object)

Method

Unwraps the given object, if it is atomic. If it is not atomic, the object will be returned untouched.

IndexTypeName
1Objectobject
Return Type

Object

Modifiers

public static