public static final class ConcurrentQueueFactory.GenericQueue<E> extends java.util.concurrent.ConcurrentLinkedQueue<E> implements ConcurrentQueue<E>, ConcurrentQueueConsumer<E>, ConcurrentQueueProducer<E>
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID |
Constructor and Description |
---|
GenericQueue() |
Modifier and Type | Method and Description |
---|---|
int |
capacity() |
int |
consume(ConsumerFunction<E> consumer,
int batchSize)
As many elements as are visible are delivered to the
Consumer . |
ConcurrentQueueConsumer<E> |
consumer() |
int |
produce(ProducerFunction<E> producer,
int batchSize) |
ConcurrentQueueProducer<E> |
producer() |
boolean |
weakOffer(E e) |
E |
weakPeek()
Return the next element from the queue, but don't remove it.
|
E |
weakPoll()
Remove the next element from the queue and return it.
|
add, addAll, contains, isEmpty, iterator, offer, peek, poll, remove, size, spliterator, toArray, toArray
containsAll, removeAll, retainAll, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
size
clear, peek, poll
offer
private static final long serialVersionUID
public ConcurrentQueueConsumer<E> consumer()
consumer
in interface ConcurrentQueue<E>
public ConcurrentQueueProducer<E> producer()
producer
in interface ConcurrentQueue<E>
public int capacity()
capacity
in interface ConcurrentQueue<E>
public int produce(ProducerFunction<E> producer, int batchSize)
produce
in interface ConcurrentQueueProducer<E>
public int consume(ConsumerFunction<E> consumer, int batchSize)
ConcurrentQueueConsumer
Consumer
.consume
in interface ConcurrentQueueConsumer<E>
batchSize
- this is the limit on the batch consume operation, but it is possible that less are availablepublic boolean weakOffer(E e)
weakOffer
in interface ConcurrentQueueProducer<E>
public E weakPoll()
ConcurrentQueueConsumer
weakPoll
in interface ConcurrentQueueConsumer<E>
public E weakPeek()
ConcurrentQueueConsumer
weakPeek
in interface ConcurrentQueueConsumer<E>