|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ICountDownLatch
ICountDownLatch is a backed-up distributed implementation of
java.util.concurrent.CountDownLatch
.
setCount(int)
becomes
the owner of the countdown and is responsible for staying connected to
the cluster until the count reaches zero. If the owner becomes disconnected prior
to count reaching zero all awaiting threads will be notified. This provides a
safety mechanism in the distributed environment.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.hazelcast.core.Instance |
---|
Instance.InstanceType |
Method Summary | |
---|---|
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. |
LocalCountDownLatchStats |
getLocalCountDownLatchStats()
|
String |
getName()
Returns the name of this ICountDownLatch instance. |
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. |
Methods inherited from interface com.hazelcast.core.Instance |
---|
destroy, getId, getInstanceType |
Method Detail |
---|
String getName()
void await() throws InstanceDestroyedException, MemberLeftException, InterruptedException
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:
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.
InstanceDestroyedException
- if the instance is destroyed while waiting
MemberLeftException
- if the countdown owner becomes disconnected while waiting
InterruptedException
- if the current thread is interrupted
IllegalStateException
- if hazelcast instance is shutdown while waitingboolean await(long timeout, TimeUnit unit) throws InstanceDestroyedException, MemberLeftException, InterruptedException
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:
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.
timeout
- the maximum time to waitunit
- the time unit of the timeout
argument
true
if the count reached zero and false
if the waiting time elapsed before the count reached zero
InstanceDestroyedException
- if the instance is destroyed while waiting
MemberLeftException
- if the countdown owner becomes disconnected while waiting
InterruptedException
- if the current thread is interrupted
IllegalStateException
- if hazelcast instance is shutdown while waitingvoid countDown()
null
.
boolean hasCount()
true
if count is greater than zeroboolean setCount(int count)
null
; and
MemberLeftException
.
false
.
count
- the number of times countDown()
must be invoked
before threads can pass through await()
true
if the new count was set or false
if the current
count is not zero
IllegalArgumentException
- if count
is negativeLocalCountDownLatchStats getLocalCountDownLatchStats()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |