|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object biz.chitec.quarterback.util.ThreadInterface biz.chitec.quarterback.util.LimitedThreadInterface
Implements a @see biz.chitec.quarterback.util.ThreadInterface which allows you to dynamically control the internal queue size. If the internal queue would grow beyond its maximum size the producer thread is stopped and waits for the consumer to clean up the queue.
Nested Class Summary |
Nested classes inherited from class biz.chitec.quarterback.util.ThreadInterface |
ThreadInterface.ChainElem |
Field Summary | |
private ThreadKicker |
gc
|
private int |
maxGems
|
private ThreadKicker |
tk
|
Fields inherited from class biz.chitec.quarterback.util.ThreadInterface |
closing, consumersleeping, first, worked |
Constructor Summary | |
LimitedThreadInterface()
Constructor which sets the maximum queue size to the default of ten entries. |
|
LimitedThreadInterface(int maxItems)
Constructor which also sets the max internal queue size |
Method Summary | |
void |
close()
Does exactly what it is expected to be doing. |
java.lang.Object |
consume()
Get an object from the internal queue. |
void |
produce(java.lang.Object o)
Puts an object on the internal queue. |
void |
setThreadQueueSize(int maxItems)
Dynamically adjusts internal queue size. |
Methods inherited from class biz.chitec.quarterback.util.ThreadInterface |
consume, consumerSleeping, consumerWouldIdle, isClosing |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private ThreadKicker tk
private ThreadKicker gc
private int maxGems
Constructor Detail |
public LimitedThreadInterface(int maxItems)
maxItems
- The maximum number of entries to the queue tablepublic LimitedThreadInterface()
Method Detail |
public java.lang.Object consume() throws java.io.IOException
consume
in class ThreadInterface
Throws
- an IOException if object is already closed.
java.io.IOException
- If the ThreadInterface is closed in the meantime.public void produce(java.lang.Object o) throws java.io.IOException
produce
in class ThreadInterface
o
- The object to be put in queue.
Throws
- an IOException if object is already closed.
java.io.IOException
public void close()
close
in class ThreadInterface
public void setThreadQueueSize(int maxItems) throws java.io.IOException
maxItems
- The new maximum number of queue items.
Throws
- an IOException if object is already closed.
java.io.IOException
|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |