com.hazelcast.client.proxy
Class ClientAtomicReferenceProxy<E>

java.lang.Object
  extended by com.hazelcast.client.spi.ClientProxy
      extended by com.hazelcast.client.proxy.ClientAtomicReferenceProxy<E>
All Implemented Interfaces:
DistributedObject, IAtomicReference<E>

public class ClientAtomicReferenceProxy<E>
extends ClientProxy
implements IAtomicReference<E>


Constructor Summary
ClientAtomicReferenceProxy(String serviceName, String objectId)
           
 
Method Summary
 void alter(IFunction<E,E> function)
          Alters the currently stored reference by applying a function on it.
 E alterAndGet(IFunction<E,E> function)
          Alters the currently stored reference by applying a function on it and gets the result.
<R> R
apply(IFunction<E,R> function)
          Applies a function on the value, the actual stored value will not change.
 void clear()
          Clears the current stored reference.
 boolean compareAndSet(E expect, E update)
          Atomically sets the value to the given updated value only if the current value == the expected value.
 boolean contains(E expected)
          Checks if the reference contains the value.
 E get()
          Gets the current value.
 E getAndAlter(IFunction<E,E> function)
          Alters the currently stored reference by applying a function on it on and gets the old value.
 E getAndSet(E newValue)
          Gets the old value and sets the new value.
protected
<T> T
invoke(ClientRequest req)
           
 boolean isNull()
          Checks if the stored reference is null.
 void set(E newValue)
          Atomically sets the given value.
 E setAndGet(E update)
          Sets and gets the 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.DistributedObject
destroy, getId, getName, getPartitionKey, getServiceName
 

Constructor Detail

ClientAtomicReferenceProxy

public ClientAtomicReferenceProxy(String serviceName,
                                  String objectId)
Method Detail

apply

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

Specified by:
apply in interface IAtomicReference<E>
Parameters:
function - the function applied on the value, the stored value does not change
Returns:
the result of the function application

alter

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

Specified by:
alter in interface IAtomicReference<E>
Parameters:
function - the function that alters the currently stored reference

alterAndGet

public E alterAndGet(IFunction<E,E> function)
Description copied from interface: IAtomicReference
Alters the currently stored reference by applying a function on it and gets the result.

Specified by:
alterAndGet in interface IAtomicReference<E>
Parameters:
function - the function that alters the currently stored reference
Returns:
the new value, the result of the applied function.

getAndAlter

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

Specified by:
getAndAlter in interface IAtomicReference<E>
Parameters:
function - the function that alters the currently stored reference
Returns:
the old value, the value before the function is applied

compareAndSet

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

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

contains

public boolean contains(E expected)
Description copied from interface: IAtomicReference
Checks if the reference contains the value.

Specified by:
contains in interface IAtomicReference<E>
Parameters:
expected - the value to check (is allowed to be null).
Returns:
true if the value is found, false otherwise.

get

public E get()
Description copied from interface: IAtomicReference
Gets the current value.

Specified by:
get in interface IAtomicReference<E>
Returns:
the current value

set

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

Specified by:
set in interface IAtomicReference<E>
Parameters:
newValue - the new value

clear

public void clear()
Description copied from interface: IAtomicReference
Clears the current stored reference.

Specified by:
clear in interface IAtomicReference<E>

getAndSet

public E getAndSet(E newValue)
Description copied from interface: IAtomicReference
Gets the old value and sets the new value.

Specified by:
getAndSet in interface IAtomicReference<E>
Parameters:
newValue - the new value.
Returns:
the old value.

setAndGet

public E setAndGet(E update)
Description copied from interface: IAtomicReference
Sets and gets the value.

Specified by:
setAndGet in interface IAtomicReference<E>
Parameters:
update - the new value
Returns:
the new value

isNull

public boolean isNull()
Description copied from interface: IAtomicReference
Checks if the stored reference is null.

Specified by:
isNull in interface IAtomicReference<E>
Returns:
true if null, false otherwise.

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.