public class BatchedArrayBlockingQueue<T> extends java.util.AbstractQueue<T> implements java.util.concurrent.BlockingQueue<T>, BatchedBlockingQueue<T>
BlockingQueue backed by an array with fixed capacity.
This queue only allows 1 consumer thread to dequeue items and multiple producer threads.
| Constructor and Description |
|---|
BatchedArrayBlockingQueue(int capacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
int |
drainTo(java.util.Collection<? super T> c) |
int |
drainTo(java.util.Collection<? super T> c,
int maxElements) |
java.util.Iterator<T> |
iterator() |
boolean |
offer(T e) |
boolean |
offer(T e,
long timeout,
java.util.concurrent.TimeUnit unit) |
T |
peek() |
T |
poll() |
T |
poll(long timeout,
java.util.concurrent.TimeUnit unit) |
int |
pollAll(T[] array,
long timeout,
java.util.concurrent.TimeUnit unit)
Removes multiple items from the queue.
|
void |
put(T e) |
int |
putAll(java.util.List<T> c) |
void |
putAll(T[] a,
int offset,
int len) |
int |
remainingCapacity() |
int |
size() |
T |
take() |
int |
takeAll(T[] array)
Drain the queue into an array.
|
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic boolean offer(T e)
public void put(T e) throws java.lang.InterruptedException
put in interface java.util.concurrent.BlockingQueue<T>java.lang.InterruptedExceptionpublic int putAll(java.util.List<T> c) throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void putAll(T[] a, int offset, int len) throws java.lang.InterruptedException
putAll in interface BatchedBlockingQueue<T>java.lang.InterruptedExceptionpublic boolean offer(T e, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
offer in interface java.util.concurrent.BlockingQueue<T>java.lang.InterruptedExceptionpublic T take() throws java.lang.InterruptedException
take in interface java.util.concurrent.BlockingQueue<T>java.lang.InterruptedExceptionpublic T poll(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
poll in interface java.util.concurrent.BlockingQueue<T>java.lang.InterruptedExceptionpublic int remainingCapacity()
remainingCapacity in interface java.util.concurrent.BlockingQueue<T>public int drainTo(java.util.Collection<? super T> c)
drainTo in interface java.util.concurrent.BlockingQueue<T>public int drainTo(java.util.Collection<? super T> c, int maxElements)
drainTo in interface java.util.concurrent.BlockingQueue<T>public int takeAll(T[] array) throws java.lang.InterruptedException
BatchedBlockingQueuetakeAll in interface BatchedBlockingQueue<T>java.lang.InterruptedExceptionpublic int pollAll(T[] array, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
BatchedBlockingQueuepollAll in interface BatchedBlockingQueue<T>java.lang.InterruptedExceptionpublic void clear()
public int size()
Copyright © 2011–2022 The Apache Software Foundation. All rights reserved.