com.flat502.rox.utils
Class ThreadQueue
java.lang.Object
com.flat502.rox.utils.ThreadQueue
public class ThreadQueue
- extends java.lang.Object
This class implements a queue for blocking and releasing
threads in a FIFO order.
When a thread calls the capture()
method it
is blocked until release()
is invoked. Threads are
guaranteed to be released in the order in which they were
captured.
This class is used to ensure fairness when sharing finite
resources across multiple threads.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ThreadQueue
public ThreadQueue()
ThreadQueue
public ThreadQueue(java.lang.Object mutex)
capture
public void capture()
capture
public void capture(long timeout)
throws CaptureTimeoutException
- Throws:
CaptureTimeoutException
release
public void release()