com.hazelcast.concurrent.atomiclong
Class AtomicLongProxy

java.lang.Object
  extended by com.hazelcast.spi.AbstractDistributedObject<AtomicLongService>
      extended by com.hazelcast.concurrent.atomiclong.AtomicLongProxy
All Implemented Interfaces:
AsyncAtomicLong, DistributedObject, IAtomicLong

public class AtomicLongProxy
extends AbstractDistributedObject<AtomicLongService>
implements AsyncAtomicLong


Field Summary
 
Fields inherited from class com.hazelcast.spi.AbstractDistributedObject
PARTITIONING_STRATEGY
 
Constructor Summary
AtomicLongProxy(String name, NodeEngine nodeEngine, AtomicLongService service)
           
 
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.
 InternalCompletableFuture<Long> asyncAddAndGet(long delta)
          Atomically adds the given value to the current value.
 InternalCompletableFuture<Void> asyncAlter(IFunction<Long,Long> function)
          Alters the currently stored value by applying a function on it.
 InternalCompletableFuture<Long> asyncAlterAndGet(IFunction<Long,Long> function)
          Alters the currently stored value by applying a function on it and gets the result.
<R> InternalCompletableFuture<R>
asyncApply(IFunction<Long,R> function)
          Applies a function on the value, the actual stored value will not change.
 InternalCompletableFuture<Boolean> asyncCompareAndSet(long expect, long update)
          Atomically sets the value to the given updated value only if the current value == the expected value.
 InternalCompletableFuture<Long> asyncDecrementAndGet()
          Atomically decrements the current value by one.
 InternalCompletableFuture<Long> asyncGet()
          Gets the current value.
 InternalCompletableFuture<Long> asyncGetAndAdd(long delta)
          Atomically adds the given value to the current value.
 InternalCompletableFuture<Long> asyncGetAndAlter(IFunction<Long,Long> function)
          Alters the currently stored value by applying a function on it on and gets the old value.
 InternalCompletableFuture<Long> asyncGetAndIncrement()
          Atomically increments the current value by one.
 InternalCompletableFuture<Long> asyncGetAndSet(long newValue)
          Atomically sets the given value and returns the old value.
 InternalCompletableFuture<Long> asyncIncrementAndGet()
          Atomically increments the current value by one.
 InternalCompletableFuture<Void> asyncSet(long newValue)
          Atomically sets the given value.
 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.
 int getPartitionId()
           
 String getServiceName()
          Returns the service name for this object.
 long incrementAndGet()
          Atomically increments the current value by one.
 void set(long newValue)
          Atomically sets the given value.
 String toString()
           
 
Methods inherited from class com.hazelcast.spi.AbstractDistributedObject
destroy, equals, getId, getNameAsPartitionAwareData, getNodeEngine, getPartitionKey, getService, hashCode, invalidate, postDestroy, throwNotActiveException
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.hazelcast.core.DistributedObject
destroy, getId, getPartitionKey
 

Constructor Detail

AtomicLongProxy

public AtomicLongProxy(String name,
                       NodeEngine nodeEngine,
                       AtomicLongService service)
Method Detail

getName

public String getName()
Description copied from interface: IAtomicLong
Returns the name of this IAtomicLong instance.

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

getPartitionId

public int getPartitionId()

getServiceName

public String getServiceName()
Description copied from interface: DistributedObject
Returns the service name for this object.

Specified by:
getServiceName in interface DistributedObject
Specified by:
getServiceName in class AbstractDistributedObject<AtomicLongService>
Returns:
the service name for this object.

addAndGet

public long addAndGet(long delta)
Description copied from interface: IAtomicLong
Atomically adds the given value to the current value.

Specified by:
addAndGet in interface IAtomicLong
Parameters:
delta - the value to add to the current value
Returns:
the updated value, the given value added to the current value

asyncAddAndGet

public InternalCompletableFuture<Long> asyncAddAndGet(long delta)
Description copied from interface: AsyncAtomicLong
Atomically adds the given value to the current value.

Specified by:
asyncAddAndGet in interface AsyncAtomicLong
Parameters:
delta - the value to add
Returns:
the updated value

compareAndSet

public boolean compareAndSet(long expect,
                             long update)
Description copied from interface: IAtomicLong
Atomically sets the value to the given updated value only if the current value == the expected value.

Specified by:
compareAndSet in interface IAtomicLong
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.

asyncCompareAndSet

public InternalCompletableFuture<Boolean> asyncCompareAndSet(long expect,
                                                             long update)
Description copied from interface: AsyncAtomicLong
Atomically sets the value to the given updated value only if the current value == the expected value.

Specified by:
asyncCompareAndSet in interface AsyncAtomicLong
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.

set

public void set(long newValue)
Description copied from interface: IAtomicLong
Atomically sets the given value.

Specified by:
set in interface IAtomicLong
Parameters:
newValue - the new value

asyncSet

public InternalCompletableFuture<Void> asyncSet(long newValue)
Description copied from interface: AsyncAtomicLong
Atomically sets the given value.

Specified by:
asyncSet in interface AsyncAtomicLong
Parameters:
newValue - the new value

getAndSet

public long getAndSet(long newValue)
Description copied from interface: IAtomicLong
Atomically sets the given value and returns the old value.

Specified by:
getAndSet in interface IAtomicLong
Parameters:
newValue - the new value
Returns:
the old value

asyncGetAndSet

public InternalCompletableFuture<Long> asyncGetAndSet(long newValue)
Description copied from interface: AsyncAtomicLong
Atomically sets the given value and returns the old value.

Specified by:
asyncGetAndSet in interface AsyncAtomicLong
Parameters:
newValue - the new value
Returns:
the old value

getAndAdd

public long getAndAdd(long delta)
Description copied from interface: IAtomicLong
Atomically adds the given value to the current value.

Specified by:
getAndAdd in interface IAtomicLong
Parameters:
delta - the value to add to the current value
Returns:
the old value before the add

asyncGetAndAdd

public InternalCompletableFuture<Long> asyncGetAndAdd(long delta)
Description copied from interface: AsyncAtomicLong
Atomically adds the given value to the current value.

Specified by:
asyncGetAndAdd in interface AsyncAtomicLong
Parameters:
delta - the value to add
Returns:
the old value before the add

decrementAndGet

public long decrementAndGet()
Description copied from interface: IAtomicLong
Atomically decrements the current value by one.

Specified by:
decrementAndGet in interface IAtomicLong
Returns:
the updated value, the current value decremented by one

asyncDecrementAndGet

public InternalCompletableFuture<Long> asyncDecrementAndGet()
Description copied from interface: AsyncAtomicLong
Atomically decrements the current value by one.

Specified by:
asyncDecrementAndGet in interface AsyncAtomicLong
Returns:
the updated value

get

public long get()
Description copied from interface: IAtomicLong
Gets the current value.

Specified by:
get in interface IAtomicLong
Returns:
the current value

asyncGet

public InternalCompletableFuture<Long> asyncGet()
Description copied from interface: AsyncAtomicLong
Gets the current value.

Specified by:
asyncGet in interface AsyncAtomicLong
Returns:
the current value

incrementAndGet

public long incrementAndGet()
Description copied from interface: IAtomicLong
Atomically increments the current value by one.

Specified by:
incrementAndGet in interface IAtomicLong
Returns:
the updated value, the current value incremented by one

asyncIncrementAndGet

public InternalCompletableFuture<Long> asyncIncrementAndGet()
Description copied from interface: AsyncAtomicLong
Atomically increments the current value by one.

Specified by:
asyncIncrementAndGet in interface AsyncAtomicLong
Returns:
the updated value

getAndIncrement

public long getAndIncrement()
Description copied from interface: IAtomicLong
Atomically increments the current value by one.

Specified by:
getAndIncrement in interface IAtomicLong
Returns:
the old value

asyncGetAndIncrement

public InternalCompletableFuture<Long> asyncGetAndIncrement()
Description copied from interface: AsyncAtomicLong
Atomically increments the current value by one.

Specified by:
asyncGetAndIncrement in interface AsyncAtomicLong
Returns:
the old value

alter

public void alter(IFunction<Long,Long> function)
Description copied from interface: IAtomicLong
Alters the currently stored value by applying a function on it.

Specified by:
alter in interface IAtomicLong
Parameters:
function - the function applied to the currently stored value

asyncAlter

public InternalCompletableFuture<Void> asyncAlter(IFunction<Long,Long> function)
Description copied from interface: AsyncAtomicLong
Alters the currently stored value by applying a function on it.

Specified by:
asyncAlter in interface AsyncAtomicLong
Parameters:
function - the function

alterAndGet

public long alterAndGet(IFunction<Long,Long> function)
Description copied from interface: IAtomicLong
Alters the currently stored value by applying a function on it and gets the result.

Specified by:
alterAndGet in interface IAtomicLong
Parameters:
function - the function applied to the currently stored value
Returns:
the new value.

asyncAlterAndGet

public InternalCompletableFuture<Long> asyncAlterAndGet(IFunction<Long,Long> function)
Description copied from interface: AsyncAtomicLong
Alters the currently stored value by applying a function on it and gets the result.

Specified by:
asyncAlterAndGet in interface AsyncAtomicLong
Parameters:
function - the function
Returns:
the new value.

getAndAlter

public long getAndAlter(IFunction<Long,Long> function)
Description copied from interface: IAtomicLong
Alters the currently stored value by applying a function on it on and gets the old value.

Specified by:
getAndAlter in interface IAtomicLong
Parameters:
function - the function applied to the currently stored value
Returns:
the old value

asyncGetAndAlter

public InternalCompletableFuture<Long> asyncGetAndAlter(IFunction<Long,Long> function)
Description copied from interface: AsyncAtomicLong
Alters the currently stored value by applying a function on it on and gets the old value.

Specified by:
asyncGetAndAlter in interface AsyncAtomicLong
Parameters:
function - the function
Returns:
the old value

apply

public <R> R apply(IFunction<Long,R> function)
Description copied from interface: IAtomicLong
Applies a function on the value, the actual stored value will not change.

Specified by:
apply in interface IAtomicLong
Parameters:
function - the function applied to the value, the value is not changed
Returns:
the result of the function application

asyncApply

public <R> InternalCompletableFuture<R> asyncApply(IFunction<Long,R> function)
Description copied from interface: AsyncAtomicLong
Applies a function on the value, the actual stored value will not change.

Specified by:
asyncApply in interface AsyncAtomicLong
Parameters:
function - the function
Returns:
the result of the function application

toString

public String toString()
Overrides:
toString in class AbstractDistributedObject<AtomicLongService>


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