|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.camel.util.concurrent.CountingLatch
public class CountingLatch
An alternative to a CountDownLatch
-- this implementation also supports incrementing
the latch count while counting down. It can also be used to count up to 0 from a negative integer.
Constructor Summary | |
---|---|
CountingLatch()
Create a new counting latch (starting count is 0) |
Method Summary | |
---|---|
void |
await()
Await the latch reaching the count of 0 |
boolean |
await(long timeout,
TimeUnit unit)
Wait for a given timeout while checking if the latch reached the count of 0 |
void |
decrement()
Decrement the count with 1 |
int |
getCount()
Get the current count |
void |
increment()
Increment the count with 1 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CountingLatch()
Method Detail |
---|
public int getCount()
public void increment()
public void decrement()
public void await() throws InterruptedException
InterruptedException
- if the threads gets interrupted while waitingpublic boolean await(long timeout, TimeUnit unit) throws InterruptedException
timeout
- the value of the timeoutunit
- the unit in which the timeout is expressed
true
if the latch has reached the count of 0 in the given time
InterruptedException
- if the thread gets interrupted while waiting
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |