com.hazelcast.client.proxy
Class ClientAtomicLongProxy

java.lang.Object
  extended by com.hazelcast.client.spi.ClientProxy
      extended by com.hazelcast.client.proxy.ClientAtomicLongProxy
All Implemented Interfaces:
DistributedObject, IAtomicLong

public class ClientAtomicLongProxy
extends ClientProxy
implements IAtomicLong


Constructor Summary
ClientAtomicLongProxy(String serviceName, String objectId)
           
 
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.
 long incrementAndGet()
          Atomically increments the current value by one.
protected
<T> T
invoke(ClientRequest req)
           
 void set(long newValue)
          Atomically sets the given value.
 String toString()
           
 
Methods inherited from class com.hazelcast.client.spi.ClientProxy
destroy, equals, getContext, getId, getName, getPartitionKey, getServiceName, hashCode, invoke, invoke, invokeInterruptibly, listen, listen, onDestroy, onInitialize, onShutdown, setContext, stopListening, throwExceptionIfNull, toData, toObject
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.hazelcast.core.IAtomicLong
getName
 
Methods inherited from interface com.hazelcast.core.DistributedObject
destroy, getId, getPartitionKey, getServiceName
 

Constructor Detail

ClientAtomicLongProxy

public ClientAtomicLongProxy(String serviceName,
                             String objectId)
Method Detail

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

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

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.

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

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

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.

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

get

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

Specified by:
get in interface IAtomicLong
Returns:
the current 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

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

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

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

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

invoke

protected <T> T invoke(ClientRequest req)
Overrides:
invoke in class ClientProxy

toString

public String toString()
Overrides:
toString in class Object


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