com.hazelcast.core
Interface AsyncAtomicReference<E>

All Superinterfaces:
DistributedObject, IAtomicReference<E>
All Known Implementing Classes:
AtomicReferenceProxy

@Beta
public interface AsyncAtomicReference<E>
extends IAtomicReference<E>

A IAtomicReference that exposes its operations using a ICompletableFuture so it can be used in the reactive programming model approach.

Since:
3.2

Method Summary
 ICompletableFuture<Void> asyncAlter(IFunction<E,E> function)
          Alters the currently stored reference by applying a function on it.
 ICompletableFuture<E> asyncAlterAndGet(IFunction<E,E> function)
          Alters the currently stored reference by applying a function on it and gets the result.
<R> ICompletableFuture<R>
asyncApply(IFunction<E,R> function)
          Applies a function on the value, the actual stored value will not change.
 ICompletableFuture<Void> asyncClear()
          Clears the current stored reference.
 ICompletableFuture<Boolean> asyncCompareAndSet(E expect, E update)
          Atomically sets the value to the given updated value only if the current value == the expected value.
 ICompletableFuture<Boolean> asyncContains(E value)
          Checks if the reference contains the value.
 ICompletableFuture<E> asyncGet()
          Gets the current value.
 ICompletableFuture<E> asyncGetAndAlter(IFunction<E,E> function)
          Alters the currently stored reference by applying a function on it on and gets the old value.
 ICompletableFuture<E> asyncGetAndSet(E newValue)
          Gets the value and sets the new value.
 ICompletableFuture<Boolean> asyncIsNull()
          Checks if the stored reference is null.
 ICompletableFuture<Void> asyncSet(E newValue)
          Atomically sets the given value.
 ICompletableFuture<E> asyncSetAndGet(E update)
          Deprecated. will be removed from Hazelcast 3.4 since it doesn't really serve a purpose.
 
Methods inherited from interface com.hazelcast.core.IAtomicReference
alter, alterAndGet, apply, clear, compareAndSet, contains, get, getAndAlter, getAndSet, isNull, set, setAndGet
 
Methods inherited from interface com.hazelcast.core.DistributedObject
destroy, getId, getName, getPartitionKey, getServiceName
 

Method Detail

asyncCompareAndSet

ICompletableFuture<Boolean> asyncCompareAndSet(E expect,
                                               E update)
Atomically sets the value to the given updated value only if the current value == the expected value.

Parameters:
expect - the expected value
update - the new value
Returns:
true if successful; or false if the actual value was not equal to the expected value.

asyncGet

ICompletableFuture<E> asyncGet()
Gets the current value.

Returns:
the current value

asyncSet

ICompletableFuture<Void> asyncSet(E newValue)
Atomically sets the given value.

Parameters:
newValue - the new value

asyncGetAndSet

ICompletableFuture<E> asyncGetAndSet(E newValue)
Gets the value and sets the new value.

Parameters:
newValue - the new value.
Returns:
the old value.

asyncSetAndGet

ICompletableFuture<E> asyncSetAndGet(E update)
Deprecated. will be removed from Hazelcast 3.4 since it doesn't really serve a purpose.

Sets and gets the value.

Parameters:
update - the new value
Returns:
the new value

asyncIsNull

ICompletableFuture<Boolean> asyncIsNull()
Checks if the stored reference is null.

Returns:
true if null, false otherwise.

asyncClear

ICompletableFuture<Void> asyncClear()
Clears the current stored reference.


asyncContains

ICompletableFuture<Boolean> asyncContains(E value)
Checks if the reference contains the value.

Parameters:
value - the value to check (is allowed to be null).
Returns:
true if the value is found, false otherwise.

asyncAlter

ICompletableFuture<Void> asyncAlter(IFunction<E,E> function)
Alters the currently stored reference by applying a function on it.

Parameters:
function - the function
Throws:
IllegalArgumentException - if function is null.

asyncAlterAndGet

ICompletableFuture<E> asyncAlterAndGet(IFunction<E,E> function)
Alters the currently stored reference by applying a function on it and gets the result.

Parameters:
function - the function
Returns:
the new value.
Throws:
IllegalArgumentException - if function is null.

asyncGetAndAlter

ICompletableFuture<E> asyncGetAndAlter(IFunction<E,E> function)
Alters the currently stored reference by applying a function on it on and gets the old value.

Parameters:
function - the function
Returns:
the old value
Throws:
IllegalArgumentException - if function is null.

asyncApply

<R> ICompletableFuture<R> asyncApply(IFunction<E,R> function)
Applies a function on the value, the actual stored value will not change.

Parameters:
function - the function
Returns:
the result of the function application
Throws:
IllegalArgumentException - if function is null.


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.