|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthudson.util.OneShotEvent
public final class OneShotEvent
Concurrency primitive.
A OneShotEvent
is like a pandora's box.
It starts with the closed (non-signaled) state.
Multiple threads can wait for the event to become the signaled state.
Once the event becomes signaled, or the pandora's box is opened, every thread gets through freely, and there's no way to turn it back off.
Constructor Summary | |
---|---|
OneShotEvent()
|
|
OneShotEvent(Object lock)
|
Method Summary | |
---|---|
void |
block()
Blocks until the event becomes the signaled state. |
void |
block(long timeout)
Blocks until the event becomes the signaled state. |
boolean |
isSignaled()
Returns true if a value is offered. |
void |
signal()
Non-blocking method that signals this event. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OneShotEvent()
public OneShotEvent(Object lock)
Method Detail |
---|
public void signal()
public void block() throws InterruptedException
This method blocks infinitely until a value is offered.
InterruptedException
public void block(long timeout) throws InterruptedException
If the specified amount of time elapses, this method returns null even if the value isn't offered.
InterruptedException
public boolean isSignaled()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |