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[]
buffer
protected long
mask
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 int
capacity()
void
clear()
long
currentConsumerIndex()
long
currentProducerIndex()
int
drainTo(java.util.Collection<? super E> c)
int
drainTo(java.util.Collection<? super E> c, int maxElements)
boolean
isEmpty()
java.util.Iterator<E>
iterator()
long
lvConsumerIndex()
long
lvProducerIndex()
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()
int
size()
E
take()
java.lang.String
toString()
-
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:
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
-
lvConsumerIndex
public final long lvConsumerIndex()
-
lvProducerIndex
public final long lvProducerIndex()
-
size
public int size()
- Specified by:
size
in interfacejava.util.Collection<E extends java.lang.Object>
- Specified by:
size
in interfaceorg.jctools.queues.MessagePassingQueue<E extends java.lang.Object>
- Specified by:
size
in classjava.util.AbstractCollection<E extends java.lang.Object>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacejava.util.Collection<E extends java.lang.Object>
- Specified by:
isEmpty
in interfaceorg.jctools.queues.MessagePassingQueue<E extends java.lang.Object>
- Overrides:
isEmpty
in classjava.util.AbstractCollection<E extends java.lang.Object>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.util.AbstractCollection<E extends java.lang.Object>
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Collection<E extends java.lang.Object>
- Specified by:
clear
in interfaceorg.jctools.queues.MessagePassingQueue<E extends java.lang.Object>
- Overrides:
clear
in classjava.util.AbstractQueue<E extends java.lang.Object>
-
capacity
public int capacity()
- Specified by:
capacity
in interfaceorg.jctools.queues.IndexedQueueSizeUtil.IndexedQueue
- Specified by:
capacity
in interfaceorg.jctools.queues.MessagePassingQueue<E extends java.lang.Object>
-
currentProducerIndex
public long currentProducerIndex()
- Specified by:
currentProducerIndex
in interfaceorg.jctools.queues.QueueProgressIndicators
-
currentConsumerIndex
public long currentConsumerIndex()
- Specified by:
currentConsumerIndex
in interfaceorg.jctools.queues.QueueProgressIndicators
-
iterator
public java.util.Iterator<E> iterator()
- Specified by:
iterator
in interfacejava.util.Collection<E extends java.lang.Object>
- Specified by:
iterator
in interfacejava.lang.Iterable<E extends java.lang.Object>
- Specified by:
iterator
in classjava.util.AbstractCollection<E extends java.lang.Object>
-
-