|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.util.concurrent.BlockingCounter
public final class BlockingCounter
A simple counter that can will cause threads calling the await()
method to block while its value
is > 0. The counter may only be incremented and decremented and must have a value >= 0.
Constructor Summary | |
---|---|
BlockingCounter()
|
|
BlockingCounter(int count)
|
Method Summary | |
---|---|
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()
|
String |
toString()
|
void |
up()
|
boolean |
wouldBlock()
Returns true if calling await() at the same very moment would block. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BlockingCounter()
public BlockingCounter(int count)
Method Detail |
---|
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.
InterruptedException
AbstractQueuedSynchronizer.acquireSharedInterruptibly(int)
public void awaitUninterruptibly()
AbstractQueuedSynchronizer.doAcquireShared(int)
public boolean wouldBlock()
await()
at the same very moment would block.
await()
would blockpublic int getCount()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |