Class JCToolsBlockingQueueFactory.MpscBlockingQueue<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<E>
-
- org.jctools.queues.ConcurrentCircularArrayQueue<E>
-
- org.jctools.queues.MpscArrayQueue<E>
-
- org.apache.logging.log4j.core.async.JCToolsBlockingQueueFactory.MpscBlockingQueue<E>
-
- All Implemented Interfaces:
java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.concurrent.BlockingQueue<E>
,java.util.Queue<E>
,org.jctools.queues.IndexedQueueSizeUtil.IndexedQueue
,org.jctools.queues.MessagePassingQueue<E>
,org.jctools.queues.QueueProgressIndicators
- Enclosing class:
- JCToolsBlockingQueueFactory<E>
private static final class JCToolsBlockingQueueFactory.MpscBlockingQueue<E> extends org.jctools.queues.MpscArrayQueue<E> implements java.util.concurrent.BlockingQueue<E>
BlockingQueue wrapper for JCTools multiple producer single consumer array queue.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jctools.queues.MessagePassingQueue
org.jctools.queues.MessagePassingQueue.Consumer<T extends java.lang.Object>, org.jctools.queues.MessagePassingQueue.ExitCondition, org.jctools.queues.MessagePassingQueue.Supplier<T extends java.lang.Object>, org.jctools.queues.MessagePassingQueue.WaitStrategy
-
-
Field Summary
Fields Modifier and Type Field Description protected long
consumerIndex
private JCToolsBlockingQueueFactory.WaitStrategy
waitStrategy
-
Constructor Summary
Constructors Constructor Description MpscBlockingQueue(int capacity, JCToolsBlockingQueueFactory.WaitStrategy waitStrategy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
casProducerIndex(long arg0, long arg1)
int
drainTo(java.util.Collection<? super E> c)
int
drainTo(java.util.Collection<? super E> c, int maxElements)
protected long
lpConsumerIndex()
long
lvConsumerIndex()
long
lvProducerIndex()
protected long
lvProducerLimit()
boolean
offer(E e)
boolean
offer(E e, long timeout, java.util.concurrent.TimeUnit unit)
E
poll(long timeout, java.util.concurrent.TimeUnit unit)
void
put(E e)
int
remainingCapacity()
protected void
soConsumerIndex(long arg0)
protected void
soProducerLimit(long arg0)
E
take()
-
Methods inherited from class org.jctools.queues.MpscArrayQueue
drain, drain, drain, failFastOffer, fill, fill, fill, offerIfBelowThreshold, peek, poll, relaxedOffer, relaxedPeek, relaxedPoll
-
Methods inherited from class org.jctools.queues.ConcurrentCircularArrayQueue
calcElementOffset, calcElementOffset, capacity, clear, currentConsumerIndex, currentProducerIndex, isEmpty, iterator, size, toString
-
Methods inherited from class java.util.AbstractCollection
contains, containsAll, remove, removeAll, retainAll, toArray, toArray
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
waitStrategy
private final JCToolsBlockingQueueFactory.WaitStrategy waitStrategy
-
consumerIndex
protected long consumerIndex
-
-
Constructor Detail
-
MpscBlockingQueue
MpscBlockingQueue(int capacity, JCToolsBlockingQueueFactory.WaitStrategy waitStrategy)
-
-
Method Detail
-
drainTo
public int drainTo(java.util.Collection<? super E> c)
- Specified by:
drainTo
in interfacejava.util.concurrent.BlockingQueue<E>
-
drainTo
public int drainTo(java.util.Collection<? super E> c, int maxElements)
- Specified by:
drainTo
in interfacejava.util.concurrent.BlockingQueue<E>
-
offer
public boolean offer(E e, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
- Specified by:
offer
in interfacejava.util.concurrent.BlockingQueue<E>
- Throws:
java.lang.InterruptedException
-
poll
public E poll(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
- Specified by:
poll
in interfacejava.util.concurrent.BlockingQueue<E>
- Throws:
java.lang.InterruptedException
-
put
public void put(E e) throws java.lang.InterruptedException
- Specified by:
put
in interfacejava.util.concurrent.BlockingQueue<E>
- Throws:
java.lang.InterruptedException
-
offer
public boolean offer(E e)
-
remainingCapacity
public int remainingCapacity()
- Specified by:
remainingCapacity
in interfacejava.util.concurrent.BlockingQueue<E>
-
take
public E take() throws java.lang.InterruptedException
- Specified by:
take
in interfacejava.util.concurrent.BlockingQueue<E>
- Throws:
java.lang.InterruptedException
-
lpConsumerIndex
protected final long lpConsumerIndex()
-
lvConsumerIndex
public final long lvConsumerIndex()
-
soConsumerIndex
protected void soConsumerIndex(long arg0)
-
lvProducerLimit
protected final long lvProducerLimit()
-
soProducerLimit
protected final void soProducerLimit(long arg0)
-
lvProducerIndex
public final long lvProducerIndex()
-
casProducerIndex
protected final boolean casProducerIndex(long arg0, long arg1)
-
-