|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.gargoylesoftware.base.trace.BlockingCircularQueue
public class BlockingCircularQueue
Internal use only.
.A circular queue with blocking semantics.
| Field Summary | |
|---|---|
private java.lang.Object |
addLock_
|
private int |
back_
|
private int |
capacity_
|
private int |
front_
|
private java.lang.Object |
getLock_
|
private java.lang.Object[] |
queue_
|
private static long |
serialVersionUID
|
private 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(java.lang.Object object)
Add an object to the queue. |
protected void |
assertNotNull(java.lang.String fieldName,
java.lang.Object fieldValue)
Verify that the specified value is not null. |
void |
clear()
Remove all items from the queue |
private 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. |
java.lang.Object |
next()
Return the next item in the queue. |
int |
size()
Return the number of objects currently in the collection. |
java.lang.String |
toString()
Return a string representation of this object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
private final java.lang.Object getLock_
private final java.lang.Object addLock_
private final java.lang.Object[] queue_
private final int capacity_
private int size_
private int front_
private int back_
| Constructor Detail |
|---|
public BlockingCircularQueue()
public BlockingCircularQueue(int capacity)
capacity - The size of the queue| Method Detail |
|---|
public void clear()
public boolean add(java.lang.Object object)
object - The object to add.
public java.lang.Object next()
private int incrementPosition(int position)
position - The position to increment
public int size()
public boolean isEmpty()
public java.lang.String toString()
toString in class java.lang.Object
protected final void assertNotNull(java.lang.String fieldName,
java.lang.Object fieldValue)
throws DetailedNullPointerException
fieldName - The name of the field to checkfieldValue - The value of the field to check
DetailedNullPointerException - If fieldValue is null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||