Package org.apache.felix.framework.util
Class ThreadGate
java.lang.Object
org.apache.felix.framework.util.ThreadGate
This class implements a simple one-shot gate for threads. The gate
 starts closed and will block any threads that try to wait on it. Once
 opened, all waiting threads will be released. The gate cannot be reused.
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionbooleanawait(long timeout) Wait for the gate to open.Returns the message object associated with the gate; the message is just an arbitrary object used to pass information to the waiting threads.voidopen()Open the gate and release any waiting threads.voidsetMessage(Object msg) Sets the message object associated with the gate. 
- 
Constructor Details
- 
ThreadGate
public ThreadGate() 
 - 
 - 
Method Details
- 
open
public void open()Open the gate and release any waiting threads. - 
getMessage
Returns the message object associated with the gate; the message is just an arbitrary object used to pass information to the waiting threads.- Returns:
 - the message object associated with the gate.
 
 - 
setMessage
Sets the message object associated with the gate. The message object can only be set once, subsequent calls to this method are ignored.- Parameters:
 msg- the message object to associate with this gate.
 - 
await
Wait for the gate to open.- Returns:
 - true if the gate was opened or false if the timeout expired.
 - Throws:
 InterruptedException- If the calling thread is interrupted; the gate still remains closed until opened.
 
 -