public class CountDownLatchClientProxy extends Object implements ICountDownLatch
Instance.InstanceType
Constructor and Description |
---|
CountDownLatchClientProxy(HazelcastClient hazelcastClient,
String name) |
Modifier and Type | Method and Description |
---|---|
void |
await()
Causes the current thread to wait until the latch has counted down to
zero or an exception is thrown.
|
boolean |
await(long timeout,
TimeUnit unit)
Causes the current thread to wait until the latch has counted down to
zero, 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 instance cluster-wide.
|
int |
getCount() |
Object |
getId()
Returns the unique id for this instance.
|
Instance.InstanceType |
getInstanceType()
Returns instance type such as map, set, list, lock, topic, multimap, id generator
|
LocalCountDownLatchStats |
getLocalCountDownLatchStats() |
String |
getName()
Returns the name of this ICountDownLatch instance.
|
Member |
getOwner() |
boolean |
hasCount()
Returns whether the current count is greater than zero.
|
boolean |
setCount(int count)
Sets the count to the given value if the current count is zero.
|
public CountDownLatchClientProxy(HazelcastClient hazelcastClient, String name)
public void await() throws InstanceDestroyedException, MemberLeftException, InterruptedException
ICountDownLatch
If the current count is zero then this method returns immediately.
If the current count is greater than zero then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of four things happen:
ICountDownLatch.countDown()
method;
InstanceDestroyedException
will be thrown.
If the countdown owner becomes disconnected while waiting then
MemberLeftException
will be thrown.
If the current thread:
InterruptedException
is thrown and the current thread's
interrupted status is cleared.await
in interface ICountDownLatch
InstanceDestroyedException
- if the instance is destroyed while waitingMemberLeftException
- if the countdown owner becomes disconnected while waitingInterruptedException
- if the current thread is interruptedpublic boolean await(long timeout, TimeUnit unit) throws InstanceDestroyedException, MemberLeftException, InterruptedException
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;
If the count reaches zero then the method returns with the
value true
.
InstanceDestroyedException
will be thrown.
If the countdown owner becomes disconnected while waiting then
MemberLeftException
will be thrown.
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 and false
if the waiting time elapsed before the count reached zeroInstanceDestroyedException
- if the instance is destroyed while waitingMemberLeftException
- if the countdown owner becomes disconnected while waitingInterruptedException
- if the current thread is interruptedpublic void countDown()
ICountDownLatch
null
.
countDown
in interface ICountDownLatch
public int getCount()
public Member getOwner()
public boolean hasCount()
ICountDownLatch
hasCount
in interface ICountDownLatch
true
if count is greater than zeropublic boolean setCount(int count)
ICountDownLatch
null
; and
MemberLeftException
.
false
.setCount
in interface ICountDownLatch
count
- the number of times ICountDownLatch.countDown()
must be invoked
before threads can pass through ICountDownLatch.await()
true
if the new count was set or false
if the current
count is not zeropublic void destroy()
Instance
public Object getId()
Instance
public Instance.InstanceType getInstanceType()
Instance
getInstanceType
in interface Instance
public String getName()
ICountDownLatch
getName
in interface ICountDownLatch
public LocalCountDownLatchStats getLocalCountDownLatchStats()
getLocalCountDownLatchStats
in interface ICountDownLatch
Copyright © 2013 Hazelcast, Inc.. All rights reserved.