org.apache.qpid.client.util
Class FlowControllingBlockingQueue
java.lang.Object
org.apache.qpid.client.util.FlowControllingBlockingQueue
public class FlowControllingBlockingQueue
- extends java.lang.Object
A blocking queue that emits events above a user specified threshold allowing
the caller to take action (e.g. flow control) to try to prevent the queue
growing (much) further. The underlying queue itself is not bounded therefore
the caller is not obliged to react to the events.
This implementation is only safe where we have a single thread adding
items and a single (different) thread removing items.
Method Summary |
void |
add(java.lang.Object o)
|
java.lang.Object |
take()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FlowControllingBlockingQueue
public FlowControllingBlockingQueue(int threshold,
FlowControllingBlockingQueue.ThresholdListener listener)
FlowControllingBlockingQueue
public FlowControllingBlockingQueue(int highThreshold,
int lowThreshold,
FlowControllingBlockingQueue.ThresholdListener listener)
take
public java.lang.Object take()
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
add
public void add(java.lang.Object o)