Package io.pravega.common.util
Class BlockingDrainingQueue<T>
- java.lang.Object
-
- io.pravega.common.util.AbstractDrainingQueue<T>
-
- io.pravega.common.util.BlockingDrainingQueue<T>
-
- Type Parameters:
T- The type of the items in the queue.
@ThreadSafe public class BlockingDrainingQueue<T> extends AbstractDrainingQueue<T>
Single-priority implementation forAbstractDrainingQueue. All items in this queue are treated fairly (there is no priority level assigned or accepted for queue items).
-
-
Constructor Summary
Constructors Constructor Description BlockingDrainingQueue()Creates a new instance of the BlockingDrainingQueue class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddInternal(T item)Updates the internal data structure to include the given item.protected java.util.Queue<T>fetch(int maxCount)Extracts a number of items from the queue.protected TpeekInternal()Returns the first item in the Queue.protected intsizeInternal()Returns the size of the queue.-
Methods inherited from class io.pravega.common.util.AbstractDrainingQueue
add, cancelPendingTake, close, newTakeResult, peek, poll, size, take, take
-
-
-
-
Method Detail
-
addInternal
protected void addInternal(T item)
Description copied from class:AbstractDrainingQueueUpdates the internal data structure to include the given item. NOTE: this is invoked while holding the lock. There is no need for additional synchronization in the implementation.- Specified by:
addInternalin classAbstractDrainingQueue<T>- Parameters:
item- The item to include.
-
sizeInternal
protected int sizeInternal()
Description copied from class:AbstractDrainingQueueReturns the size of the queue. NOTE: this is invoked while holding the lock. There is no need for additional synchronization in the implementation.- Specified by:
sizeInternalin classAbstractDrainingQueue<T>- Returns:
- The size of the queue.
-
peekInternal
protected T peekInternal()
Description copied from class:AbstractDrainingQueueReturns the first item in the Queue. NOTE: this is invoked while holding the lock. There is no need for additional synchronization in the implementation.- Specified by:
peekInternalin classAbstractDrainingQueue<T>- Returns:
- The first item, or null if
AbstractDrainingQueue.size()is 0.
-
fetch
protected java.util.Queue<T> fetch(int maxCount)
Description copied from class:AbstractDrainingQueueExtracts a number of items from the queue. NOTE: this is invoked while holding the lock. There is no need for additional synchronization in the implementation.- Specified by:
fetchin classAbstractDrainingQueue<T>- Parameters:
maxCount- The maximum number of items to extract.- Returns:
- The extracted items, in order.
-
-