E
- type of referenced objectpublic class ClientAtomicReferenceProxy<E> extends ClientProxy implements IAtomicReference<E>
IAtomicReference
.name
Constructor and Description |
---|
ClientAtomicReferenceProxy(String serviceName,
String objectId,
ClientContext context) |
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.
|
InternalCompletableFuture<E> |
alterAndGetAsync(IFunction<E,E> function)
Alters the currently stored reference by applying a function on it and
gets the result.
|
InternalCompletableFuture<Void> |
alterAsync(IFunction<E,E> function)
Alters the currently stored reference by applying a function on it.
|
<R> R |
apply(IFunction<E,R> function)
Applies a function on the value, the actual stored value will not
change.
|
<R> InternalCompletableFuture<R> |
applyAsync(IFunction<E,R> function)
Applies a function on the value, the actual stored value will not
change.
|
void |
clear()
Clears the current stored reference.
|
InternalCompletableFuture<Void> |
clearAsync()
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. |
InternalCompletableFuture<Boolean> |
compareAndSetAsync(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.
|
InternalCompletableFuture<Boolean> |
containsAsync(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.
|
InternalCompletableFuture<E> |
getAndAlterAsync(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.
|
InternalCompletableFuture<E> |
getAndSetAsync(E newValue)
Gets the value and sets the new value.
|
InternalCompletableFuture<E> |
getAsync()
Gets the current value.
|
protected ClientMessage |
invokeOnPartition(ClientMessage req) |
protected <T> T |
invokeOnPartition(ClientMessage clientMessage,
long invocationTimeoutSeconds) |
protected <T> ClientDelegatingFuture<T> |
invokeOnPartitionAsync(ClientMessage clientMessage,
ClientMessageDecoder clientMessageDecoder) |
protected <T> T |
invokeOnPartitionInterruptibly(ClientMessage clientMessage) |
protected <T> T |
invokeOnPartitionInterruptibly(ClientMessage clientMessage,
long invocationTimeoutSeconds) |
boolean |
isNull()
Checks if the stored reference is
null . |
InternalCompletableFuture<Boolean> |
isNullAsync()
Checks if the stored reference is
null . |
protected void |
onInitialize()
Called when proxy is created.
|
void |
set(E newValue)
Atomically sets the given value.
|
E |
setAndGet(E update)
Sets and gets the value.
|
InternalCompletableFuture<Void> |
setAsync(E newValue)
Atomically sets the given value.
|
String |
toString() |
deregisterListener, destroy, destroyLocally, destroyRemotely, equals, getClient, getConnectedServerVersion, getContext, getDistributedObjectName, getId, getName, getPartitionKey, getSerializationService, getServiceName, hashCode, invoke, invoke, invokeOnAddress, invokeOnPartition, invokeOnPartitionInterruptibly, onDestroy, onShutdown, postDestroy, preDestroy, registerListener, setContext, toData, toObject
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
destroy, getName, getPartitionKey, getServiceName
public ClientAtomicReferenceProxy(String serviceName, String objectId, ClientContext context)
public <R> InternalCompletableFuture<R> applyAsync(IFunction<E,R> function)
IAtomicReference
applyAsync
in interface IAtomicReference<E>
function
- the functionpublic <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 InternalCompletableFuture<Void> alterAsync(IFunction<E,E> function)
IAtomicReference
alterAsync
in interface IAtomicReference<E>
function
- the functionpublic void alter(IFunction<E,E> function)
IAtomicReference
alter
in interface IAtomicReference<E>
function
- the function that alters the currently stored referencepublic InternalCompletableFuture<E> alterAndGetAsync(IFunction<E,E> function)
IAtomicReference
alterAndGetAsync
in interface IAtomicReference<E>
function
- the functionpublic E alterAndGet(IFunction<E,E> function)
IAtomicReference
alterAndGet
in interface IAtomicReference<E>
function
- the function that alters the currently stored referencepublic InternalCompletableFuture<E> getAndAlterAsync(IFunction<E,E> function)
IAtomicReference
getAndAlterAsync
in interface IAtomicReference<E>
function
- the functionpublic E getAndAlter(IFunction<E,E> function)
IAtomicReference
getAndAlter
in interface IAtomicReference<E>
function
- the function that alters the currently stored referencepublic InternalCompletableFuture<Boolean> compareAndSetAsync(E expect, E update)
IAtomicReference
==
the expected value.compareAndSetAsync
in interface IAtomicReference<E>
expect
- the expected valueupdate
- the new valuetrue
if successful; or false
if the actual value
was not equal to the expected valuepublic boolean compareAndSet(E expect, E update)
IAtomicReference
==
the expected value.compareAndSet
in interface IAtomicReference<E>
expect
- the expected valueupdate
- the new valuetrue
if successful; or false
if the actual value
was not equal to the expected valuepublic InternalCompletableFuture<Boolean> containsAsync(E expected)
IAtomicReference
containsAsync
in interface IAtomicReference<E>
expected
- the value to check (is allowed to be null)true
if the value is found, false
otherwisepublic boolean contains(E expected)
IAtomicReference
contains
in interface IAtomicReference<E>
expected
- the value to check (is allowed to be null
)true
if the value is found, false
otherwisepublic InternalCompletableFuture<E> getAsync()
IAtomicReference
getAsync
in interface IAtomicReference<E>
public E get()
IAtomicReference
get
in interface IAtomicReference<E>
public InternalCompletableFuture<Void> setAsync(E newValue)
IAtomicReference
setAsync
in interface IAtomicReference<E>
newValue
- the new valuepublic void set(E newValue)
IAtomicReference
set
in interface IAtomicReference<E>
newValue
- the new valuepublic InternalCompletableFuture<Void> clearAsync()
IAtomicReference
clearAsync
in interface IAtomicReference<E>
public void clear()
IAtomicReference
clear
in interface IAtomicReference<E>
public InternalCompletableFuture<E> getAndSetAsync(E newValue)
IAtomicReference
getAndSetAsync
in interface IAtomicReference<E>
newValue
- the new valuepublic E getAndSet(E newValue)
IAtomicReference
getAndSet
in interface IAtomicReference<E>
newValue
- the new valuepublic E setAndGet(E update)
IAtomicReference
setAndGet
in interface IAtomicReference<E>
update
- the new valuepublic InternalCompletableFuture<Boolean> isNullAsync()
IAtomicReference
null
.isNullAsync
in interface IAtomicReference<E>
true
if null
, false
otherwisepublic boolean isNull()
IAtomicReference
null
.isNull
in interface IAtomicReference<E>
true
if null
, false
otherwiseprotected void onInitialize()
ClientProxy
onInitialize
in class ClientProxy
protected ClientMessage invokeOnPartition(ClientMessage req)
protected <T> T invokeOnPartitionInterruptibly(ClientMessage clientMessage) throws InterruptedException
InterruptedException
protected <T> ClientDelegatingFuture<T> invokeOnPartitionAsync(ClientMessage clientMessage, ClientMessageDecoder clientMessageDecoder)
protected <T> T invokeOnPartition(ClientMessage clientMessage, long invocationTimeoutSeconds)
protected <T> T invokeOnPartitionInterruptibly(ClientMessage clientMessage, long invocationTimeoutSeconds) throws InterruptedException
InterruptedException
Copyright © 2022 Hazelcast, Inc.. All Rights Reserved.