T - type of the referenced valuespublic class RaftAtomicRefProxy<T> extends Object implements IAtomicReference<T>
IAtomicReference| Constructor and Description |
|---|
RaftAtomicRefProxy(NodeEngine nodeEngine,
RaftGroupId groupId,
String proxyName,
String objectName) |
| Modifier and Type | Method and Description |
|---|---|
void |
alter(IFunction<T,T> function)
Alters the currently stored reference by applying a function on it.
|
T |
alterAndGet(IFunction<T,T> function)
Alters the currently stored reference by applying a function on it and
gets the result.
|
InternalCompletableFuture<T> |
alterAndGetAsync(IFunction<T,T> function)
Alters the currently stored reference by applying a function on it and
gets the result.
|
InternalCompletableFuture<Void> |
alterAsync(IFunction<T,T> function)
Alters the currently stored reference by applying a function on it.
|
<R> R |
apply(IFunction<T,R> function)
Applies a function on the value, the actual stored value will not
change.
|
<R> InternalCompletableFuture<R> |
applyAsync(IFunction<T,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(T expect,
T update)
Atomically sets the value to the given updated value
only if the current value
== the expected value. |
InternalCompletableFuture<Boolean> |
compareAndSetAsync(T expect,
T update)
Atomically sets the value to the given updated value only if the
current value
== the expected value. |
boolean |
contains(T value)
Checks if the reference contains the value.
|
InternalCompletableFuture<Boolean> |
containsAsync(T expected)
Checks if the reference contains the value.
|
void |
destroy()
Destroys this object cluster-wide.
|
T |
get()
Gets the current value.
|
T |
getAndAlter(IFunction<T,T> function)
Alters the currently stored reference by applying a function on it on
and gets the old value.
|
InternalCompletableFuture<T> |
getAndAlterAsync(IFunction<T,T> function)
Alters the currently stored reference by applying a function on it on
and gets the old value.
|
T |
getAndSet(T newValue)
Gets the old value and sets the new value.
|
InternalCompletableFuture<T> |
getAndSetAsync(T newValue)
Gets the value and sets the new value.
|
InternalCompletableFuture<T> |
getAsync()
Gets the current value.
|
CPGroupId |
getGroupId() |
String |
getName()
Returns the unique name for this DistributedObject.
|
String |
getPartitionKey()
Returns the key of the partition that this DistributedObject is assigned to.
|
String |
getServiceName()
Returns the service name for this object.
|
boolean |
isNull()
Checks if the stored reference is
null. |
InternalCompletableFuture<Boolean> |
isNullAsync()
Checks if the stored reference is
null. |
void |
set(T newValue)
Atomically sets the given value.
|
T |
setAndGet(T update)
Sets and gets the value.
|
InternalCompletableFuture<Void> |
setAsync(T newValue)
Atomically sets the given value.
|
public RaftAtomicRefProxy(NodeEngine nodeEngine, RaftGroupId groupId, String proxyName, String objectName)
public boolean compareAndSet(T expect, T update)
IAtomicReference== the expected value.compareAndSet in interface IAtomicReference<T>expect - the expected valueupdate - the new valuetrue if successful; or false if the actual value
was not equal to the expected valuepublic T get()
IAtomicReferenceget in interface IAtomicReference<T>public void set(T newValue)
IAtomicReferenceset in interface IAtomicReference<T>newValue - the new valuepublic T getAndSet(T newValue)
IAtomicReferencegetAndSet in interface IAtomicReference<T>newValue - the new valuepublic T setAndGet(T update)
IAtomicReferencesetAndGet in interface IAtomicReference<T>update - the new valuepublic boolean isNull()
IAtomicReferencenull.isNull in interface IAtomicReference<T>true if null, false otherwisepublic void clear()
IAtomicReferenceclear in interface IAtomicReference<T>public boolean contains(T value)
IAtomicReferencecontains in interface IAtomicReference<T>value - the value to check (is allowed to be null)true if the value is found, false otherwisepublic void alter(IFunction<T,T> function)
IAtomicReferencealter in interface IAtomicReference<T>function - the function that alters the currently stored referencepublic T alterAndGet(IFunction<T,T> function)
IAtomicReferencealterAndGet in interface IAtomicReference<T>function - the function that alters the currently stored referencepublic T getAndAlter(IFunction<T,T> function)
IAtomicReferencegetAndAlter in interface IAtomicReference<T>function - the function that alters the currently stored referencepublic <R> R apply(IFunction<T,R> function)
IAtomicReferenceapply in interface IAtomicReference<T>function - the function applied on the value, the stored value does not changepublic InternalCompletableFuture<Boolean> compareAndSetAsync(T expect, T update)
IAtomicReference== the expected value.compareAndSetAsync in interface IAtomicReference<T>expect - the expected valueupdate - the new valuetrue if successful; or false if the actual value
was not equal to the expected valuepublic InternalCompletableFuture<T> getAsync()
IAtomicReferencegetAsync in interface IAtomicReference<T>public InternalCompletableFuture<Void> setAsync(T newValue)
IAtomicReferencesetAsync in interface IAtomicReference<T>newValue - the new valuepublic InternalCompletableFuture<T> getAndSetAsync(T newValue)
IAtomicReferencegetAndSetAsync in interface IAtomicReference<T>newValue - the new valuepublic InternalCompletableFuture<Boolean> isNullAsync()
IAtomicReferencenull.isNullAsync in interface IAtomicReference<T>true if null, false otherwisepublic InternalCompletableFuture<Void> clearAsync()
IAtomicReferenceclearAsync in interface IAtomicReference<T>public InternalCompletableFuture<Boolean> containsAsync(T expected)
IAtomicReferencecontainsAsync in interface IAtomicReference<T>expected - the value to check (is allowed to be null)true if the value is found, false otherwisepublic InternalCompletableFuture<Void> alterAsync(IFunction<T,T> function)
IAtomicReferencealterAsync in interface IAtomicReference<T>function - the functionpublic InternalCompletableFuture<T> alterAndGetAsync(IFunction<T,T> function)
IAtomicReferencealterAndGetAsync in interface IAtomicReference<T>function - the functionpublic InternalCompletableFuture<T> getAndAlterAsync(IFunction<T,T> function)
IAtomicReferencegetAndAlterAsync in interface IAtomicReference<T>function - the functionpublic <R> InternalCompletableFuture<R> applyAsync(IFunction<T,R> function)
IAtomicReferenceapplyAsync in interface IAtomicReference<T>function - the functionpublic String getPartitionKey()
DistributedObjectIAtomicLong. For a partitioned data structure like an IMap,
the returned value will not be null, but otherwise undefined.getPartitionKey in interface DistributedObjectpublic String getName()
DistributedObjectDistributedObjectUtil.getName(DistributedObject)
because this might be also a PrefixedDistributedObject.getName in interface DistributedObjectpublic String getServiceName()
DistributedObjectgetServiceName in interface DistributedObjectpublic void destroy()
DistributedObjectdestroy in interface DistributedObjectpublic CPGroupId getGroupId()
Copyright © 2020 Hazelcast, Inc.. All Rights Reserved.