|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.util.Consumer
Provides support for a multi-threaded producer/consumer.
Subclasses should call the init() method before using the consumer.
Supported API: false
Extendable: false
Nested Class Summary | |
protected static interface |
Consumer.Producer
A utility interface that the Consumer uses to producer data. |
protected static interface |
Consumer.Queue
Utility interface that the Consumer uses to buffer data. |
protected static class |
Consumer.SynchronizedQueue
Provides basic synchronization for a multi-threaded producer/consumer situation. |
Field Summary | |
protected static int |
DEFAULT_BUFFER_SIZE
|
protected Consumer.Producer |
producer
|
protected Consumer.Queue |
queue
|
Constructor Summary | |
Consumer()
|
Method Summary | |
protected Consumer.Queue |
createQueue(int max_buffer_size)
Hook to let subclasses create a different queue. |
void |
finalize()
This method should be called if you would like to stop iterating prematurely, to allow cleanup work to be done. |
boolean |
hasNext()
|
protected void |
init(Consumer.Producer p)
|
protected void |
init(Consumer.Producer p,
Consumer.Queue q)
|
protected void |
init(Consumer.Producer p,
int max_buffer_size)
|
Object |
next()
|
void |
remove()
Throws an UnsupportedOperationException. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final int DEFAULT_BUFFER_SIZE
protected Consumer.Producer producer
protected Consumer.Queue queue
Constructor Detail |
public Consumer()
Method Detail |
protected final void init(Consumer.Producer p, Consumer.Queue q)
p
- The producer that will load the data.q
- The queue to get data from.protected final void init(Consumer.Producer p, int max_buffer_size)
p
- The producer that will load the data.max_buffer_size
- The number of lines that should be buffered internally by the consumer.protected final void init(Consumer.Producer p)
p
- The producer that will load the data.protected Consumer.Queue createQueue(int max_buffer_size)
max_buffer_size
- The maximum size the queue can attain.public final boolean hasNext()
hasNext
in interface Iterator
public final Object next()
next
in interface Iterator
public final void remove()
remove
in interface Iterator
public void finalize()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |