com.hazelcast.core
Interface AsyncAtomicLong

All Superinterfaces:
DistributedObject, IAtomicLong
All Known Implementing Classes:
AtomicLongProxy

@Beta
public interface AsyncAtomicLong
extends IAtomicLong

This interface is an IAtomicLong interface that exposes its operations using an ICompletableFuture interface so it can be used in the reactive programming model approach.

Since:
3.2

Method Summary
 ICompletableFuture<Long> asyncAddAndGet(long delta)
          Atomically adds the given value to the current value.
 ICompletableFuture<Void> asyncAlter(IFunction<Long,Long> function)
          Alters the currently stored value by applying a function on it.
 ICompletableFuture<Long> asyncAlterAndGet(IFunction<Long,Long> function)
          Alters the currently stored value by applying a function on it and gets the result.
<R> ICompletableFuture<R>
asyncApply(IFunction<Long,R> function)
          Applies a function on the value, the actual stored value will not change.
 ICompletableFuture<Boolean> asyncCompareAndSet(long expect, long update)
          Atomically sets the value to the given updated value only if the current value == the expected value.
 ICompletableFuture<Long> asyncDecrementAndGet()
          Atomically decrements the current value by one.
 ICompletableFuture<Long> asyncGet()
          Gets the current value.
 ICompletableFuture<Long> asyncGetAndAdd(long delta)
          Atomically adds the given value to the current value.
 ICompletableFuture<Long> asyncGetAndAlter(IFunction<Long,Long> function)
          Alters the currently stored value by applying a function on it on and gets the old value.
 ICompletableFuture<Long> asyncGetAndIncrement()
          Atomically increments the current value by one.
 ICompletableFuture<Long> asyncGetAndSet(long newValue)
          Atomically sets the given value and returns the old value.
 ICompletableFuture<Long> asyncIncrementAndGet()
          Atomically increments the current value by one.
 ICompletableFuture<Void> asyncSet(long newValue)
          Atomically sets the given value.
 
Methods inherited from interface com.hazelcast.core.IAtomicLong
addAndGet, alter, alterAndGet, apply, compareAndSet, decrementAndGet, get, getAndAdd, getAndAlter, getAndIncrement, getAndSet, getName, incrementAndGet, set
 
Methods inherited from interface com.hazelcast.core.DistributedObject
destroy, getId, getPartitionKey, getServiceName
 

Method Detail

asyncAddAndGet

ICompletableFuture<Long> asyncAddAndGet(long delta)
Atomically adds the given value to the current value.

Parameters:
delta - the value to add
Returns:
the updated value

asyncCompareAndSet

ICompletableFuture<Boolean> asyncCompareAndSet(long expect,
                                               long 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.

asyncDecrementAndGet

ICompletableFuture<Long> asyncDecrementAndGet()
Atomically decrements the current value by one.

Returns:
the updated value

asyncGet

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

Returns:
the current value

asyncGetAndAdd

ICompletableFuture<Long> asyncGetAndAdd(long delta)
Atomically adds the given value to the current value.

Parameters:
delta - the value to add
Returns:
the old value before the add

asyncGetAndSet

ICompletableFuture<Long> asyncGetAndSet(long newValue)
Atomically sets the given value and returns the old value.

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

asyncIncrementAndGet

ICompletableFuture<Long> asyncIncrementAndGet()
Atomically increments the current value by one.

Returns:
the updated value

asyncGetAndIncrement

ICompletableFuture<Long> asyncGetAndIncrement()
Atomically increments the current value by one.

Returns:
the old value

asyncSet

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

Parameters:
newValue - the new value

asyncAlter

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

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

asyncAlterAndGet

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

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

asyncGetAndAlter

ICompletableFuture<Long> asyncGetAndAlter(IFunction<Long,Long> function)
Alters the currently stored value 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.
Since:
3.2

asyncApply

<R> ICompletableFuture<R> asyncApply(IFunction<Long,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.
Since:
3.2


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