public class ClientAtomicReferenceProxy<E> extends ClientProxy implements IAtomicReference<E>
Constructor and Description |
---|
ClientAtomicReferenceProxy(String serviceName,
String objectId) |
Modifier and Type | Method and Description |
---|---|
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() |
destroy, equals, getContext, getId, getName, getPartitionKey, getServiceName, hashCode, invoke, invoke, invokeInterruptibly, listen, listen, onDestroy, onInitialize, onShutdown, setContext, stopListening, throwExceptionIfNull, toData, toObject
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
destroy, getId, getName, getPartitionKey, getServiceName
public <R> R apply(IFunction<E,R> function)
IAtomicReference
apply
in interface IAtomicReference<E>
function
- the function applied on the value, the stored value does not changepublic void alter(IFunction<E,E> function)
IAtomicReference
alter
in interface IAtomicReference<E>
function
- the function that alters the currently stored referencepublic E alterAndGet(IFunction<E,E> function)
IAtomicReference
alterAndGet
in interface IAtomicReference<E>
function
- the function that alters the currently stored referencepublic E getAndAlter(IFunction<E,E> function)
IAtomicReference
getAndAlter
in interface IAtomicReference<E>
function
- the function that alters the currently stored referencepublic boolean compareAndSet(E expect, E update)
IAtomicReference
==
the expected value.compareAndSet
in interface IAtomicReference<E>
expect
- the expected valueupdate
- the new valuepublic boolean contains(E expected)
IAtomicReference
contains
in interface IAtomicReference<E>
expected
- the value to check (is allowed to be null).public E get()
IAtomicReference
get
in interface IAtomicReference<E>
public void set(E newValue)
IAtomicReference
set
in interface IAtomicReference<E>
newValue
- the new valuepublic void clear()
IAtomicReference
clear
in interface IAtomicReference<E>
public E getAndSet(E newValue)
IAtomicReference
getAndSet
in interface IAtomicReference<E>
newValue
- the new value.public E setAndGet(E update)
IAtomicReference
setAndGet
in interface IAtomicReference<E>
update
- the new valuepublic boolean isNull()
IAtomicReference
isNull
in interface IAtomicReference<E>
protected <T> T invoke(ClientRequest req)
invoke
in class ClientProxy
Copyright © 2014 Hazelcast, Inc.. All Rights Reserved.