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()
IAtomicReference
get
in interface IAtomicReference<T>
public void set(T newValue)
IAtomicReference
set
in interface IAtomicReference<T>
newValue
- the new valuepublic T getAndSet(T newValue)
IAtomicReference
getAndSet
in interface IAtomicReference<T>
newValue
- the new valuepublic T setAndGet(T update)
IAtomicReference
setAndGet
in interface IAtomicReference<T>
update
- the new valuepublic boolean isNull()
IAtomicReference
null
.isNull
in interface IAtomicReference<T>
true
if null
, false
otherwisepublic void clear()
IAtomicReference
clear
in interface IAtomicReference<T>
public boolean contains(T value)
IAtomicReference
contains
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)
IAtomicReference
alter
in interface IAtomicReference<T>
function
- the function that alters the currently stored referencepublic T alterAndGet(IFunction<T,T> function)
IAtomicReference
alterAndGet
in interface IAtomicReference<T>
function
- the function that alters the currently stored referencepublic T getAndAlter(IFunction<T,T> function)
IAtomicReference
getAndAlter
in interface IAtomicReference<T>
function
- the function that alters the currently stored referencepublic <R> R apply(IFunction<T,R> function)
IAtomicReference
apply
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()
IAtomicReference
getAsync
in interface IAtomicReference<T>
public InternalCompletableFuture<Void> setAsync(T newValue)
IAtomicReference
setAsync
in interface IAtomicReference<T>
newValue
- the new valuepublic InternalCompletableFuture<T> getAndSetAsync(T newValue)
IAtomicReference
getAndSetAsync
in interface IAtomicReference<T>
newValue
- the new valuepublic InternalCompletableFuture<Boolean> isNullAsync()
IAtomicReference
null
.isNullAsync
in interface IAtomicReference<T>
true
if null
, false
otherwisepublic InternalCompletableFuture<Void> clearAsync()
IAtomicReference
clearAsync
in interface IAtomicReference<T>
public InternalCompletableFuture<Boolean> containsAsync(T expected)
IAtomicReference
containsAsync
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)
IAtomicReference
alterAsync
in interface IAtomicReference<T>
function
- the functionpublic InternalCompletableFuture<T> alterAndGetAsync(IFunction<T,T> function)
IAtomicReference
alterAndGetAsync
in interface IAtomicReference<T>
function
- the functionpublic InternalCompletableFuture<T> getAndAlterAsync(IFunction<T,T> function)
IAtomicReference
getAndAlterAsync
in interface IAtomicReference<T>
function
- the functionpublic <R> InternalCompletableFuture<R> applyAsync(IFunction<T,R> function)
IAtomicReference
applyAsync
in interface IAtomicReference<T>
function
- the functionpublic String getPartitionKey()
DistributedObject
IAtomicLong
. For a partitioned data structure like an IMap
,
the returned value will not be null, but otherwise undefined.getPartitionKey
in interface DistributedObject
public String getName()
DistributedObject
DistributedObjectUtil.getName(DistributedObject)
because this might be also a PrefixedDistributedObject
.getName
in interface DistributedObject
public String getServiceName()
DistributedObject
getServiceName
in interface DistributedObject
public void destroy()
DistributedObject
destroy
in interface DistributedObject
public CPGroupId getGroupId()
Copyright © 2021 Hazelcast, Inc.. All Rights Reserved.