Class JCToolsBlockingQueueFactory.MpscBlockingQueue<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<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,org.jctools.queues.SupportsIterator
- 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 E[]bufferprotected longmaskprivate JCToolsBlockingQueueFactory.WaitStrategywaitStrategy
-
Constructor Summary
Constructors Constructor Description MpscBlockingQueue(int capacity, JCToolsBlockingQueueFactory.WaitStrategy waitStrategy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcapacity()voidclear()longcurrentConsumerIndex()longcurrentProducerIndex()intdrainTo(java.util.Collection<? super E> c)intdrainTo(java.util.Collection<? super E> c, int maxElements)booleanisEmpty()java.util.Iterator<E>iterator()longlvConsumerIndex()longlvProducerIndex()booleanoffer(E e)booleanoffer(E e, long timeout, java.util.concurrent.TimeUnit unit)Epoll(long timeout, java.util.concurrent.TimeUnit unit)voidput(E e)intremainingCapacity()intsize()Etake()java.lang.StringtoString()-
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 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
-
mask
protected final long mask
-
buffer
protected final E extends java.lang.Object[] buffer
-
-
Constructor Detail
-
MpscBlockingQueue
MpscBlockingQueue(int capacity, JCToolsBlockingQueueFactory.WaitStrategy waitStrategy)
-
-
Method Detail
-
drainTo
public int drainTo(java.util.Collection<? super E> c)
- Specified by:
drainToin interfacejava.util.concurrent.BlockingQueue<E>
-
drainTo
public int drainTo(java.util.Collection<? super E> c, int maxElements)
- Specified by:
drainToin interfacejava.util.concurrent.BlockingQueue<E>
-
offer
public boolean offer(E e, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
- Specified by:
offerin 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:
pollin interfacejava.util.concurrent.BlockingQueue<E>- Throws:
java.lang.InterruptedException
-
put
public void put(E e) throws java.lang.InterruptedException
- Specified by:
putin interfacejava.util.concurrent.BlockingQueue<E>- Throws:
java.lang.InterruptedException
-
offer
public boolean offer(E e)
-
remainingCapacity
public int remainingCapacity()
- Specified by:
remainingCapacityin interfacejava.util.concurrent.BlockingQueue<E>
-
take
public E take() throws java.lang.InterruptedException
- Specified by:
takein interfacejava.util.concurrent.BlockingQueue<E>- Throws:
java.lang.InterruptedException
-
lvConsumerIndex
public final long lvConsumerIndex()
-
lvProducerIndex
public final long lvProducerIndex()
-
size
public int size()
- Specified by:
sizein interfacejava.util.Collection<E extends java.lang.Object>- Specified by:
sizein interfaceorg.jctools.queues.MessagePassingQueue<E extends java.lang.Object>- Specified by:
sizein classjava.util.AbstractCollection<E extends java.lang.Object>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacejava.util.Collection<E extends java.lang.Object>- Specified by:
isEmptyin interfaceorg.jctools.queues.MessagePassingQueue<E extends java.lang.Object>- Overrides:
isEmptyin classjava.util.AbstractCollection<E extends java.lang.Object>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.util.AbstractCollection<E extends java.lang.Object>
-
clear
public void clear()
- Specified by:
clearin interfacejava.util.Collection<E extends java.lang.Object>- Specified by:
clearin interfaceorg.jctools.queues.MessagePassingQueue<E extends java.lang.Object>- Overrides:
clearin classjava.util.AbstractQueue<E extends java.lang.Object>
-
capacity
public int capacity()
- Specified by:
capacityin interfaceorg.jctools.queues.IndexedQueueSizeUtil.IndexedQueue- Specified by:
capacityin interfaceorg.jctools.queues.MessagePassingQueue<E extends java.lang.Object>
-
currentProducerIndex
public long currentProducerIndex()
- Specified by:
currentProducerIndexin interfaceorg.jctools.queues.QueueProgressIndicators
-
currentConsumerIndex
public long currentConsumerIndex()
- Specified by:
currentConsumerIndexin interfaceorg.jctools.queues.QueueProgressIndicators
-
iterator
public java.util.Iterator<E> iterator()
- Specified by:
iteratorin interfacejava.util.Collection<E extends java.lang.Object>- Specified by:
iteratorin interfacejava.lang.Iterable<E extends java.lang.Object>- Specified by:
iteratorin classjava.util.AbstractCollection<E extends java.lang.Object>
-
-