E - the type of elements.public final class OverfillQueue<E>
extends java.lang.Object
A blocking queue with a limited capacity.
When the queue is attempted to put a new element and is overfilled, the oldest element is dropped so the capacity limit is preserved.
| Constructor and Description |
|---|
OverfillQueue(int capacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
put(E element)
Inserts the specified element at the tail of this queue if it is
possible to do so without exceeding the queue's capacity.
|
E |
take()
Retrieves and removes the head of this queue, waiting for the element to become available if needed.
|
public void put(E element) throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic E take() throws java.lang.InterruptedException
java.lang.InterruptedException