Constructor and Description |
---|
BlockingCounter() |
BlockingCounter(int count) |
Modifier and Type | Method and Description |
---|---|
void |
await()
Block while counter is > 0, throwing InterruptedException if interrupted.
|
boolean |
await(long timeout,
TimeUnit unit) |
void |
awaitUninterruptibly()
Block while counter is > 0, ignoring interrupts.
|
void |
down() |
int |
getCount() |
int |
getWaitingThreadCount()
Get the number of threads currently waiting
|
String |
toString() |
void |
up() |
boolean |
wouldBlock()
Returns true if calling
await() at the same very moment would block. |
public BlockingCounter()
public BlockingCounter(int count)
public void up()
public void down()
public boolean await(long timeout, TimeUnit unit) throws InterruptedException
InterruptedException
public void await() throws InterruptedException
Note the behaviour has changed since v6.1 - before that InterruptedException was never thrown due to a bug.
public void awaitUninterruptibly()
AbstractQueuedSynchronizer.doAcquireShared(int)
public boolean wouldBlock()
await()
at the same very moment would block.await()
would blockpublic int getCount()
public int getWaitingThreadCount()
Copyright © 2002-2022 Atlassian. All Rights Reserved.