com.gargoylesoftware.base.trace
public class BlockingCircularQueue extends Object implements Serializable
Internal use only.
.A circular queue with blocking semantics.
Version: $Revision: 1.7 $
Field Summary | |
---|---|
Object | addLock_ |
int | back_ |
int | capacity_ |
int | front_ |
Object | getLock_ |
Object[] | queue_ |
static long | serialVersionUID |
int | size_ |
Constructor Summary | |
---|---|
BlockingCircularQueue()
Create the queue with a capacity of 20 | |
BlockingCircularQueue(int capacity)
Create the queue with the specified capacity
|
Method Summary | |
---|---|
boolean | add(Object object)
Add an object to the queue. |
protected void | assertNotNull(String fieldName, Object fieldValue)
Verify that the specified value is not null. |
void | clear()
Remove all items from the queue |
int | incrementPosition(int position)
Utility method to increment the position and roll back to zero once we
hit the end. |
boolean | isEmpty()
Return true if the collection is empty. |
Object | next()
Return the next item in the queue. |
int | size()
Return the number of objects currently in the collection. |
String | toString()
Return a string representation of this object. |
Parameters: capacity The size of the queue
Parameters: object The object to add.
Returns: true if the object was successfully added.
Parameters: fieldName The name of the field to check fieldValue The value of the field to check
Throws: DetailedNullPointerException If fieldValue is null
Parameters: position The position to increment
Returns: the new position
Returns: true if the collection is empty.
Returns: The next item.
Returns: The object count.
Returns: a string representation of this object.