Class SpscLinkedArrayQueue<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<E>
-
- io.smallrye.mutiny.helpers.queues.SpscLinkedArrayQueue<E>
-
- Type Parameters:
E- the element type of the queue
- All Implemented Interfaces:
java.lang.Iterable<E>,java.util.Collection<E>,java.util.Queue<E>
public final class SpscLinkedArrayQueue<E> extends java.util.AbstractQueue<E> implements java.util.Queue<E>A single-producer single-consumer array-backed queue which can allocate new arrays in case the consumer is slower than the producer.Code inspired from https://github.com/JCTools/JCTools/blob/master/jctools-core/src/main/java/org/jctools/queues/atomic, and it's RX Java 2 version.
-
-
Constructor Summary
Constructors Constructor Description SpscLinkedArrayQueue(int bufferSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()booleanisEmpty()java.util.Iterator<E>iterator()booleanoffer(E e)booleanoffer(E first, E second)Offer two elements at the same time.Epeek()Epoll()intsize()-
Methods inherited from class java.util.AbstractCollection
contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Method Detail
-
offer
public boolean offer(E e)
This implementation is correct for single producer thread use only.
- Specified by:
offerin interfacejava.util.Queue<E>
-
poll
public E poll()
This implementation is correct for single consumer thread use only.
- Specified by:
pollin interfacejava.util.Queue<E>
-
clear
public void clear()
-
iterator
public java.util.Iterator<E> iterator()
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
-