java.lang.Object
org.objectstyle.cayenne.util.RequestQueue
- public class RequestQueue
- extends java.lang.Object
RequestQueue implements a FIFO queue for threads waiting for a
particular event, resource, etc. Each thread will wait
in the queue until either of the following events happen:
- Thread is already #1 in the queue and an awaited event occurrs.
- Thread timeout interval expired.
- Thread was interrupted (this is a quick way to remove thread from the queue).
If any of the conditions above ocurrs, thread will be removed from the queue.
|
Constructor Summary |
RequestQueue(int maxSize,
int timeout)
Constructor for RequestQueue. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logObj
private static org.apache.log4j.Logger logObj
queue
protected java.util.List queue
maxSize
protected int maxSize
timeout
protected int timeout
RequestQueue
public RequestQueue(int maxSize,
int timeout)
- Constructor for RequestQueue.
getSize
public int getSize()
queueThread
public RequestDequeue queueThread()
- Queues current thread. This will block
the caller till the thread is dequeued as a result
of another thread calling
dequeueFirst
or as a result of a timeout.
dequeueFirst
public boolean dequeueFirst(java.lang.Object dequeuedObj)
- Releases the first thread in the queue.