public final class PushPullBlockingQueue<E> extends PushPullConcurrentQueue<E> implements Serializable, Iterable<E>, Collection<E>, BlockingQueue<E>, Queue<E>
| Modifier and Type | Field and Description |
|---|---|
protected com.conversantmedia.util.concurrent.Condition |
queueNotEmptyCondition |
protected com.conversantmedia.util.concurrent.Condition |
queueNotFullCondition |
| Constructor and Description |
|---|
PushPullBlockingQueue(int capacity)
Construct a blocking queue of the given fixed capacity.
|
PushPullBlockingQueue(int capacity,
Collection<? extends E> c)
Construct a blocking queue of the given fixed capacity
|
PushPullBlockingQueue(int capacity,
SpinPolicy spinPolicy)
Construct a blocking queue with a given fixed capacity
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e) |
boolean |
addAll(Collection<? extends E> c) |
void |
clear()
clear the queue of all elements
|
boolean |
containsAll(Collection<?> c) |
int |
drainTo(Collection<? super E> c) |
int |
drainTo(Collection<? super E> c,
int maxElements) |
E |
element() |
Iterator<E> |
iterator() |
boolean |
offer(E e)
Add element t to the ring
|
boolean |
offer(E e,
long timeout,
TimeUnit unit) |
E |
poll()
remove the first element from the queue and return it
|
E |
poll(long timeout,
TimeUnit unit) |
void |
put(E e) |
int |
remainingCapacity() |
E |
remove() |
int |
remove(E[] e)
return all elements in the queue to the provided array, up to the size of the provided
array.
|
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
E |
take() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
capacity, contains, isEmpty, peek, sizeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcontainsequals, hashCode, isEmpty, parallelStream, removeIf, size, streamprotected final com.conversantmedia.util.concurrent.Condition queueNotFullCondition
protected final com.conversantmedia.util.concurrent.Condition queueNotEmptyCondition
public PushPullBlockingQueue(int capacity)
Construct a blocking queue of the given fixed capacity.
Note: actual capacity will be the next power of two larger than capacity.capacity - maximum capacity of this queuepublic PushPullBlockingQueue(int capacity,
SpinPolicy spinPolicy)
Construct a blocking queue with a given fixed capacity
Note: actual capacity will be the next power of two larger than capacity. Waiting locking may be used in servers that are tuned for it, waiting locking provides a high performance locking implementation which is approximately a factor of 2 improvement in throughput (40M/s for 1-1 thread transfers) However waiting locking is more CPU aggressive and causes servers that may be configured with far too many threads to show very high load averages. This is probably not as detrimental as it is annoying.capacity - - the queue capacity, power of two is suggestedspinPolicy - - determine the level of cpu aggressiveness in waitingpublic PushPullBlockingQueue(int capacity,
Collection<? extends E> c)
Construct a blocking queue of the given fixed capacity
Note: actual capacity will be the next power of two larger than capacity.
The values from the collection, c, are appended to the queue in iteration order. If the number of elements in the collection exceeds the actual capacity, then the additional elements overwrite the previous ones until all elements have been written once.capacity - maximum capacity of this queuec - A collection to use to populate inital valuespublic final boolean offer(E e)
ConcurrentQueueoffer in interface ConcurrentQueue<E>offer in interface BlockingQueue<E>offer in interface Queue<E>offer in class PushPullConcurrentQueue<E>e - - element to offerpublic final E poll()
ConcurrentQueuepoll in interface ConcurrentQueue<E>poll in interface Queue<E>poll in class PushPullConcurrentQueue<E>public int remove(E[] e)
ConcurrentQueueremove in interface ConcurrentQueue<E>remove in class PushPullConcurrentQueue<E>e - - The element arraypublic 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 void clear()
ConcurrentQueueclear in interface ConcurrentQueue<E>clear in interface Collection<E>clear in class PushPullConcurrentQueue<E>public 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 Object[] toArray()
toArray in interface Collection<E>public <T> T[] toArray(T[] a)
toArray in interface Collection<E>public boolean add(E e)
add in interface Collection<E>add in interface BlockingQueue<E>add in interface Queue<E>public boolean remove(Object o)
remove in interface Collection<E>remove in interface BlockingQueue<E>public boolean containsAll(Collection<?> c)
containsAll in interface Collection<E>public boolean addAll(Collection<? extends E> c)
addAll in interface Collection<E>public boolean removeAll(Collection<?> c)
removeAll in interface Collection<E>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<E>Copyright © 2012–2018 Conversant Engineering. All rights reserved.