public class FlowControllingBlockingQueue<T> extends Object
This implementation is only safe where we have a single thread adding items and a single (different) thread removing items.
TODO Make this implement java.util.Queue and hide the implementation. Then different queue types can be substituted.
Modifier and Type | Class and Description |
---|---|
static interface |
FlowControllingBlockingQueue.ThresholdListener |
Constructor and Description |
---|
FlowControllingBlockingQueue(int threshold,
FlowControllingBlockingQueue.ThresholdListener listener) |
FlowControllingBlockingQueue(int highThreshold,
int lowThreshold,
FlowControllingBlockingQueue.ThresholdListener listener) |
Modifier and Type | Method and Description |
---|---|
void |
add(T o) |
T |
blockingPeek() |
void |
clear() |
void |
close() |
boolean |
isEmpty() |
Iterator<T> |
iterator() |
T |
nonBlockingTake() |
boolean |
remove(T o) |
T |
take() |
public FlowControllingBlockingQueue(int threshold, FlowControllingBlockingQueue.ThresholdListener listener)
public FlowControllingBlockingQueue(int highThreshold, int lowThreshold, FlowControllingBlockingQueue.ThresholdListener listener)
public boolean isEmpty()
public void close()
public T blockingPeek() throws InterruptedException
InterruptedException
public T nonBlockingTake() throws InterruptedException
InterruptedException
public T take() throws InterruptedException
InterruptedException
public void add(T o)
public boolean remove(T o)
public void clear()
Copyright © 2006–2016 The Apache Software Foundation. All rights reserved.