E - the type of elements held in this collectionpublic class ArrayBlockingQueueWithShutdown<E> extends AbstractQueue<E> implements BlockingQueue<E>
shutdown() and start() methods. Will
throw InterruptedException if Queue has been shutdown on take() and
poll(long, TimeUnit).
Based on ArrayBlockingQueue of OpenJDK by Doug Lea (who released ArrayBlockingQueue as public domain).
| Constructor and Description |
|---|
ArrayBlockingQueueWithShutdown(int capacity) |
ArrayBlockingQueueWithShutdown(int capacity,
boolean fair) |
| Modifier and Type | Method and Description |
|---|---|
int |
drainTo(Collection<? super E> c) |
int |
drainTo(Collection<? super E> c,
int maxElements) |
boolean |
isShutdown()
Returns true if the queue is currently shut down.
|
Iterator<E> |
iterator() |
boolean |
offer(E e) |
boolean |
offer(E e,
long timeout,
TimeUnit unit) |
E |
peek() |
E |
poll() |
E |
poll(long timeout,
TimeUnit unit) |
void |
put(E e) |
int |
remainingCapacity() |
void |
shutdown()
Shutdown the Queue.
|
int |
size() |
void |
start()
Start the queue.
|
E |
take() |
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitadd, contains, removeaddAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArraypublic ArrayBlockingQueueWithShutdown(int capacity)
public ArrayBlockingQueueWithShutdown(int capacity,
boolean fair)
public void shutdown()
public void start()
shutdown().public boolean isShutdown()
public boolean offer(E e)
public void put(E e) throws InterruptedException
put in interface BlockingQueue<E>InterruptedExceptionpublic boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException
offer in interface BlockingQueue<E>InterruptedExceptionpublic E take() throws InterruptedException
take in interface BlockingQueue<E>InterruptedExceptionpublic E poll(long timeout, TimeUnit unit) throws InterruptedException
poll in interface BlockingQueue<E>InterruptedExceptionpublic int remainingCapacity()
remainingCapacity in interface BlockingQueue<E>public int drainTo(Collection<? super E> c)
drainTo in interface BlockingQueue<E>public int drainTo(Collection<? super E> c, int maxElements)
drainTo in interface BlockingQueue<E>public int size()
size in interface Collection<E>size in class AbstractCollection<E>Copyright © 2015 Ignite Realtime. All rights reserved.