public class ClientCountDownLatchProxy extends ClientProxy implements ICountDownLatch
name| Constructor and Description |
|---|
ClientCountDownLatchProxy(String serviceName,
String objectId) |
| 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.
|
int |
getCount()
Returns the current count.
|
protected ClientMessage |
invokeOnPartition(ClientMessage req) |
protected <T> T |
invokeOnPartitionInterruptibly(ClientMessage clientMessage) |
protected void |
onInitialize()
Called when proxy is created.
|
String |
toString() |
boolean |
trySetCount(int count)
Sets the count to the given value if the current count is zero.
|
deregisterListener, destroy, equals, getClient, getContext, getId, getName, getPartitionKey, getServiceName, hashCode, invoke, invoke, invokeOnPartition, invokeOnPartitionInterruptibly, onDestroy, onShutdown, registerListener, setContext, throwExceptionIfNull, toData, toObjectclone, finalize, getClass, notify, notifyAll, wait, wait, waitdestroy, getName, getPartitionKey, getServiceNamepublic boolean await(long timeout,
TimeUnit unit)
throws InterruptedException
ICountDownLatchIf 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,
If the count reaches zero, then the method returns with the
value 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 ICountDownLatchtimeout - 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 zeroInterruptedException - if the current thread is interruptedpublic void countDown()
ICountDownLatchnull.
countDown in interface ICountDownLatchpublic int getCount()
ICountDownLatchgetCount in interface ICountDownLatchpublic boolean trySetCount(int count)
ICountDownLatchfalse.trySetCount in interface ICountDownLatchcount - 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 zeroprotected void onInitialize()
ClientProxyonInitialize in class ClientProxyprotected ClientMessage invokeOnPartition(ClientMessage req)
protected <T> T invokeOnPartitionInterruptibly(ClientMessage clientMessage) throws InterruptedException
InterruptedExceptionCopyright © 2016 Hazelcast, Inc.. All Rights Reserved.