|
org.codehaus.gpars | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovyx.gpars.dataflow.impl.ResizeableCountDownLatch
public final class ResizeableCountDownLatch
CountDownLatch with the ability to change the number of waiting parties
Nested Class Summary | |
---|---|
private static class |
ResizeableCountDownLatch.Sync
Synchronization control For CountDownLatch. |
Field Summary | |
---|---|
private ResizeableCountDownLatch.Sync |
sync
|
Constructor Summary | |
ResizeableCountDownLatch()
|
Method Summary | |
---|---|
java.lang.Object
|
ResizeableCountDownLatch(int count)
Constructs a CountDownLatch initialized with the given count. |
boolean
|
attemptToCountDownAndAwait(long timeout)
Attempts to atomically count down the latch and await release with a timeout. |
void
|
await()
Causes the current thread to wait until the latch has counted down to zero, unless the thread is {
|
boolean
|
await(long timeout, java.util.concurrent.TimeUnit unit)
Causes the current thread to wait until the latch has counted down to zero, unless the thread is {
|
void
|
countDown()
Decrements the count of the latch, releasing all waiting threads if the count reaches zero. |
void
|
decreaseCount()
|
long
|
getCount()
Returns the current count. |
void
|
increaseCount()
|
boolean
|
isReleasedFlag()
|
java.lang.String
|
toString()
Returns a string identifying this latch, as well as its state. |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
private final ResizeableCountDownLatch.Sync sync
Constructor Detail |
---|
ResizeableCountDownLatch()
Method Detail |
---|
public java.lang.Object ResizeableCountDownLatch(int count)
count
- the number of times countDown must be invoked
before threads can pass through await
public boolean attemptToCountDownAndAwait(long timeout)
timeout
- The time in nanoseconds to await
public void await()
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 two things happen:
If the current thread:
public boolean await(long timeout, java.util.concurrent.TimeUnit unit)
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 three things happen:
If the count reaches zero then the method returns with the value true.
If the current thread:
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
public void countDown()
If the current count is greater than zero then it is decremented. If the new count is zero then all waiting threads are re-enabled for thread scheduling purposes.
If the current count equals zero then nothing happens.
public void decreaseCount()
public long getCount()
This method is typically used for debugging and testing purposes.
public void increaseCount()
public boolean isReleasedFlag()
public java.lang.String toString()
Copyright © 2008–2012 Václav Pech. All Rights Reserved.