|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jclass.SimpleQueue
A class reprezenting a simple static allocated queue of objects which
allows also synchronized access. It should make SyncSimpleQueue obsolete.
Written: Radu Sion
Version: 0.19x
Source: SimpleQueue.java
Visit
Smart Software
Field Summary | |
long |
FETCH_TIMEOUT
This defines the time to wait for a empty queue to receive some object before declaring the queue empty on fetching an object from it. |
long |
INSERT_TIMEOUT
This defines the time to wait for a full queue to free up before declaring the queue full on inserting a object into it Should be reasonable small (0-100). |
Constructor Summary | |
SimpleQueue(int entr)
|
Method Summary | |
void |
clear()
Clears the queue. |
java.lang.Object |
fetchNext()
Gets the next object out of the queue. |
java.lang.Object |
fetchNext(long timeout)
Fetches the next object out of queue |
int |
getMaxSize()
Gets the maximum size (entries) in the queue |
void |
Insert(java.lang.Object o)
Inserts a object in the queue. |
void |
Insert(java.lang.Object oo,
long timeout)
Inserts a new object into the queue ( no testings are done on the object ) |
boolean |
isEmpty()
Tests if the queue is empty |
boolean |
isFull()
nbsp; Tests if the queue is full. |
int |
size()
Returns the current size (entries) of the queue |
boolean |
waitEmpty(long timeout)
Waits for empty queue. |
boolean |
waitFull(long timeout)
Waits for queue to fill up. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public long INSERT_TIMEOUT
public long FETCH_TIMEOUT
Constructor Detail |
public SimpleQueue(int entr)
entr
- The maximum entries in the queueMethod Detail |
public int getMaxSize()
public boolean isEmpty()
public boolean waitEmpty(long timeout)
timeout
- Negative means wait infinite time.public boolean isFull()
public boolean waitFull(long timeout)
timeout
- Negative means wait infinite time.public int size()
public java.lang.Object fetchNext(long timeout) throws EmptyException
timeout
- Timeout to wait for Object to enter queue,
before throwing EmptyException. Negative means infinity.public void Insert(java.lang.Object oo, long timeout) throws FullException
oo
- The object to inserttimeout
- Timeout to wait before throwing FullException
in the case of full queue.public void clear()
public void Insert(java.lang.Object o) throws FullException
public java.lang.Object fetchNext() throws EmptyException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |