com.hazelcast.core
Interface IAtomicLong

All Superinterfaces:
DistributedObject
All Known Subinterfaces:
AsyncAtomicLong
All Known Implementing Classes:
AtomicLongProxy, ClientAtomicLongProxy

public interface IAtomicLong
extends DistributedObject

IAtomicLong is a redundant and highly available distributed alternative to the java.util.concurrent.atomic.AtomicLong.

See Also:
IAtomicReference

Method Summary
 long addAndGet(long delta)
          Atomically adds the given value to the current value.
 void alter(IFunction<Long,Long> function)
          Alters the currently stored value by applying a function on it.
 long alterAndGet(IFunction<Long,Long> function)
          Alters the currently stored value by applying a function on it and gets the result.
<R> R
apply(IFunction<Long,R> function)
          Applies a function on the value, the actual stored value will not change.
 boolean compareAndSet(long expect, long update)
          Atomically sets the value to the given updated value only if the current value == the expected value.
 long decrementAndGet()
          Atomically decrements the current value by one.
 long get()
          Gets the current value.
 long getAndAdd(long delta)
          Atomically adds the given value to the current value.
 long getAndAlter(IFunction<Long,Long> function)
          Alters the currently stored value by applying a function on it on and gets the old value.
 long getAndIncrement()
          Atomically increments the current value by one.
 long getAndSet(long newValue)
          Atomically sets the given value and returns the old value.
 String getName()
          Returns the name of this IAtomicLong instance.
 long incrementAndGet()
          Atomically increments the current value by one.
 void set(long newValue)
          Atomically sets the given value.
 
Methods inherited from interface com.hazelcast.core.DistributedObject
destroy, getId, getPartitionKey, getServiceName
 

Method Detail

getName

String getName()
Returns the name of this IAtomicLong instance.

Specified by:
getName in interface DistributedObject
Returns:
the name of this IAtomicLong instance

addAndGet

long addAndGet(long delta)
Atomically adds the given value to the current value.

Parameters:
delta - the value to add to the current value
Returns:
the updated value, the given value added to the current value

compareAndSet

boolean compareAndSet(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.

decrementAndGet

long decrementAndGet()
Atomically decrements the current value by one.

Returns:
the updated value, the current value decremented by one

get

long get()
Gets the current value.

Returns:
the current value

getAndAdd

long getAndAdd(long delta)
Atomically adds the given value to the current value.

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

getAndSet

long getAndSet(long newValue)
Atomically sets the given value and returns the old value.

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

incrementAndGet

long incrementAndGet()
Atomically increments the current value by one.

Returns:
the updated value, the current value incremented by one

getAndIncrement

long getAndIncrement()
Atomically increments the current value by one.

Returns:
the old value

set

void set(long newValue)
Atomically sets the given value.

Parameters:
newValue - the new value

alter

void alter(IFunction<Long,Long> function)
Alters the currently stored value by applying a function on it.

Parameters:
function - the function applied to the currently stored value
Throws:
IllegalArgumentException - if function is null.
Since:
3.2

alterAndGet

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

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

getAndAlter

long getAndAlter(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 applied to the currently stored value
Returns:
the old value
Throws:
IllegalArgumentException - if function is null.
Since:
3.2

apply

<R> R apply(IFunction<Long,R> function)
Applies a function on the value, the actual stored value will not change.

Parameters:
function - the function applied to the value, the value is not changed
Returns:
the result of the function application
Throws:
IllegalArgumentException - if function is null.
Since:
3.2


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