Class DynamicSizeBoundQueue<T>

java.lang.Object
io.airlift.concurrent.DynamicSizeBoundQueue<T>

@ThreadSafe public class DynamicSizeBoundQueue<T> extends Object
Size constrained queue that utilizes a dynamic element size function. To prevent starvation for adding large elements, the queue will only block new elements if the total size has already been reached or exceeded. This means in the normal case, the queue should be no larger than the max size plus the size of one element. Callers also have the additional option to force insert further elements without regard for size constraints. In the current implementation, elements are required to have positive sizes (they cannot have zero size). This implementation is designed to closely mirror the method signatures of BlockingQueue.