public class BoundedConcurrentQueue<ElementT> extends Object
Once the queue is full, the insertion of the next element is delayed until space becomes available again; in the meantime, additional insertions are not allowed (in other words, there can be at most one "pending" element waiting on a full queue).
Constructor and Description |
---|
BoundedConcurrentQueue(int maxSize) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Note that this does not complete a pending call to
offer(Object) . |
CompletionStage<ElementT> |
offer(ElementT element) |
ElementT |
peek() |
ElementT |
poll() |
@NonNull public CompletionStage<ElementT> offer(@NonNull ElementT element)
poll()
). This method must not be invoked
again until the stage has completed.IllegalStateException
- if the method is invoked before the stage returned by the
previous call has completed.@Nullable public ElementT poll()
@Nullable public ElementT peek()
public void clear()
offer(Object)
. We only use this
method for terminal states where we want to dereference the contained elements.Copyright © 2017–2019. All rights reserved.