public class RaftCountDownLatchProxy extends Object implements ICountDownLatch
ICountDownLatch
Constructor and Description |
---|
RaftCountDownLatchProxy(NodeEngine nodeEngine,
RaftGroupId groupId,
String proxyName,
String objectName) |
Modifier and Type | Method and Description |
---|---|
boolean |
await(long timeout,
TimeUnit unit)
Causes the current thread to wait until the latch has counted down to
zero, or an exception is thrown, or the specified waiting time elapses.
|
void |
countDown()
Decrements the count of the latch, releasing all waiting threads if
the count reaches zero.
|
void |
destroy()
Destroys this object cluster-wide.
|
int |
getCount()
Returns the current count.
|
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 |
trySetCount(int count)
Sets the count to the given value if the current count is zero.
|
public RaftCountDownLatchProxy(NodeEngine nodeEngine, RaftGroupId groupId, String proxyName, String objectName)
public boolean await(long timeout, TimeUnit unit)
ICountDownLatch
If the current count is zero then this method returns immediately
with the value true
.
If the current count is greater than zero, then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of five things happen:
ICountDownLatch.countDown()
method,
true
.
If the current thread:
InterruptedException
is thrown and the current thread's
interrupted status is cleared.
If the specified waiting time elapses then the value false
is returned. If the time is less than or equal to zero, the method
will not wait at all.
await
in interface ICountDownLatch
timeout
- the maximum time to waitunit
- the time unit of the timeout
argumenttrue
if the count reached zero, false
if the waiting time elapsed before the count reached zeropublic void countDown()
ICountDownLatch
If the current count is greater than zero, then it is decremented. If the new count is zero:
null
.
countDown
in interface ICountDownLatch
public int getCount()
ICountDownLatch
getCount
in interface ICountDownLatch
public boolean trySetCount(int count)
ICountDownLatch
If count is not zero, then this method does nothing and returns false
.
trySetCount
in interface ICountDownLatch
count
- the number of times ICountDownLatch.countDown()
must be invoked
before threads can pass through ICountDownLatch.await(long, java.util.concurrent.TimeUnit)
true
if the new count was set, false
if the current count is not zeropublic 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 © 2022 Hazelcast, Inc.. All Rights Reserved.