public class BufferingQueue extends Object implements Cloneable
All methods in this class run explicitly or implicitly synchronized on the object.
Most of the methods in this class are also declared final so they can be more readily in-lined by the compiler.
Copyright (c) 2002-2003 webMethods, Inc.
Modifier and Type | Class and Description |
---|---|
static class |
BufferingQueue.ShutdownException
The exception to be throw to kick the blocking
get()
call when the queue is shutdown() . |
Constructor and Description |
---|
BufferingQueue()
Contructs a resizable queue with a default beginning size.
|
BufferingQueue(BufferingQueue another)
Deprecated.
use the
clone() method to do the copying |
BufferingQueue(int size)
Constructs a non-resizble queue with the specified size.
|
BufferingQueue(int size,
boolean resizable)
Contructs a queue with an initial size.
|
Modifier and Type | Method and Description |
---|---|
protected Object |
clone()
Clones this object.
|
Object |
get()
Gets an object from the queue.
|
boolean |
isEmpty()
Tests if the queue is empty.
|
boolean |
isFull()
Tests if the queue is full.
|
Object |
peek()
Peeks an object from the queue.
|
void |
put(Object obj)
Adds an object to the queue.
|
void |
shutdown()
Shuts down the queue.
|
public BufferingQueue()
public BufferingQueue(int size)
size
- the size of the queue, must be > 0. If it is <=0, it is ignored
and the default constructor is call to contruct a resizable queue.public BufferingQueue(int size, boolean resizable)
size
- the size of the queue, must be > 0. If it is <=0, it is ignored
and the default size is usedresizble
- specifies if the queue is resizablepublic BufferingQueue(BufferingQueue another)
clone()
method to do the copyinganother
- the other object to copy fromprotected Object clone()
public final void put(Object obj)
get()
.
If this call is interrupted/terminated by shutdown()
, the object may be
discarded and the call returns without put it on the queue.
obj
- the Object to add to the queuepublic final Object get() throws BufferingQueue.ShutdownException
{@link
- ShutdownException}, if this call is interrupted/terminated
by shutdown()
BufferingQueue.ShutdownException
public final Object peek() throws BufferingQueue.ShutdownException
{@link
- ShutdownException}, if this call is interrupted/terminated
by shutdown()
BufferingQueue.ShutdownException
public final boolean isFull()
public final boolean isEmpty()
public void shutdown()
put(java.lang.Object)
or get()
which would then abort their current operation.