|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindbright.util.Queue
A queue of objects. New objects can be inserted first or last. The depth of the queue can be controlled and put operations will hang if there is no room. If the queue is full then any put operation will hang until the number of objects in the queue has sunk below the hiwater mark.
Constructor Summary | |
Queue()
Constructs a new queue with the default depth (64) and hiwater (32) levels. |
|
Queue(int depth,
int hiwater)
Constructs a new queue with custom depth and hiwater levels. |
Method Summary | |
void |
disable()
Disable the queue. |
void |
enable()
Enable a disabled queue. |
java.lang.Object |
getFirst()
Get the first object on the queue. |
java.lang.Object |
getFirst(long ms)
Get the first object on the queue, optionally with a timeout. |
boolean |
isEmpty()
Check if the queue is empty |
void |
putFirst(java.lang.Object obj)
insert an object at the head of the queue. |
void |
putLast(java.lang.Object obj)
Append an object to the queue. |
void |
release()
Release any blocked object. |
void |
setBlocking(boolean block)
Controls if the getFirst call should block. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Queue()
public Queue(int depth, int hiwater)
Method Detail |
public void putLast(java.lang.Object obj)
obj
- the object to appendpublic void putFirst(java.lang.Object obj)
obj
- the object to insertpublic void release()
public void disable()
public void enable()
public void setBlocking(boolean block)
block
- true if calls to getFirst should blockpublic boolean isEmpty()
public java.lang.Object getFirst(long ms)
ms
- how long, in milliseconds, to wait, if the queue is
blocking, for a new object.public java.lang.Object getFirst()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |