E - The type of elements held in this collection.public class ResizableLinkedBlockingQueue<E> extends LinkedBlockingQueue<E>
LinkedBlockingQueue implementation which performs exactly as a standard LinkedBlockingQueue, but
which supports 'resizing' of the queue too.| Constructor and Description |
|---|
ResizableLinkedBlockingQueue()
Creates a
ResizableLinkedBlockingQueue with a capacity of
Integer.MAX_VALUE. |
ResizableLinkedBlockingQueue(Collection<? extends E> c)
Creates a
ResizableLinkedBlockingQueue with a capacity of
Integer.MAX_VALUE, initially containing the elements of the
given collection,
added in traversal order of the collection's iterator. |
ResizableLinkedBlockingQueue(int initialCapacity)
Creates a
ResizableLinkedBlockingQueue with the given number of
permits. |
| Modifier and Type | Method and Description |
|---|---|
int |
getMaximumQueueSize()
Get the current maximum capacity of the queue.
|
boolean |
offer(E e) |
boolean |
offer(E e,
long timeout,
TimeUnit unit) |
E |
poll() |
E |
poll(long timeout,
TimeUnit unit) |
void |
put(E e) |
int |
remainingCapacity() |
boolean |
remove(Object o) |
void |
resizeQueue(int newSize)
Set the queue to a size between 0 and Integer.MAX_VALUE.
|
E |
take() |
clear, contains, drainTo, drainTo, iterator, peek, size, spliterator, toArray, toArray, toStringadd, addAll, element, removecontainsAll, isEmpty, removeAll, retainAllclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddaddAll, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, streampublic ResizableLinkedBlockingQueue()
ResizableLinkedBlockingQueue with a capacity of
Integer.MAX_VALUE.public ResizableLinkedBlockingQueue(Collection<? extends E> c)
ResizableLinkedBlockingQueue with a capacity of
Integer.MAX_VALUE, initially containing the elements of the
given collection,
added in traversal order of the collection's iterator.c - the collection of elements to initially containNullPointerException - if the specified collection or any
of its elements are nullpublic ResizableLinkedBlockingQueue(int initialCapacity)
ResizableLinkedBlockingQueue with the given number of
permits.initialCapacity - the initial number of permits available.
This value may be negative, in which case releases
must occur before any acquires will be granted.public void resizeQueue(int newSize)
throws IllegalArgumentException
IllegalArgumentException will be thrown instead.newSize - The new size of the queue.IllegalArgumentException - thrown when the given newSize is a minus number.public int getMaximumQueueSize()
public boolean offer(E e)
offer in interface BlockingQueue<E>offer in interface Queue<E>offer in class LinkedBlockingQueue<E>public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException
offer in interface BlockingQueue<E>offer in class LinkedBlockingQueue<E>InterruptedExceptionpublic E poll()
public E poll(long timeout, TimeUnit unit) throws InterruptedException
poll in interface BlockingQueue<E>poll in class LinkedBlockingQueue<E>InterruptedExceptionpublic void put(E e) throws InterruptedException
put in interface BlockingQueue<E>put in class LinkedBlockingQueue<E>InterruptedExceptionpublic int remainingCapacity()
remainingCapacity in interface BlockingQueue<E>remainingCapacity in class LinkedBlockingQueue<E>public boolean remove(Object o)
remove in interface Collection<E>remove in interface BlockingQueue<E>remove in class LinkedBlockingQueue<E>public E take() throws InterruptedException
take in interface BlockingQueue<E>take in class LinkedBlockingQueue<E>InterruptedExceptionCopyright © 2010–2023 Open Identity Platform Community. All rights reserved.