Package com.illumon.util.queue
Class SynchronizedLinkedConcurrentQueue<T>
java.lang.Object
com.illumon.util.queue.SynchronizedLinkedConcurrentQueue<T>
- All Implemented Interfaces:
ConcurrentQueue<T>
public class SynchronizedLinkedConcurrentQueue<T> extends Object implements ConcurrentQueue<T>
Unconstrained low-allocation queue, implemented via intrusive linked list.
All access is synchronized.
-
Constructor Summary
Constructors Constructor Description SynchronizedLinkedConcurrentQueue(IntrusiveSinglyLinkedQueue.Adapter<T> adapter) -
Method Summary
Modifier and Type Method Description Tdequeue()Returns null when the queue is empty This method should never block (but it may spin for a finite amount of time)booleanenqueue(T new_value)Returns false when the queue is full This method should never block (but it may spin for a finite amount of time)booleanenqueue(T new_value, long not_used)Spins forever until the item can be enqueued.Tpeek()Return the current next value, or null if the queue is empty.voidput(T new_value)Only return when enqueued.Ttake()Only return w/ a dequeued value.
-
Constructor Details
-
Method Details
-
enqueue
Description copied from interface:ConcurrentQueueReturns false when the queue is full This method should never block (but it may spin for a finite amount of time)- Specified by:
enqueuein interfaceConcurrentQueue<T>
-
enqueue
Description copied from interface:ConcurrentQueueSpins forever until the item can be enqueued. Calls yield() after the number of specified spins.- Specified by:
enqueuein interfaceConcurrentQueue<T>
-
dequeue
Description copied from interface:ConcurrentQueueReturns null when the queue is empty This method should never block (but it may spin for a finite amount of time)- Specified by:
dequeuein interfaceConcurrentQueue<T>
-
put
Description copied from interface:ConcurrentQueueOnly return when enqueued. (Might spin continuously)- Specified by:
putin interfaceConcurrentQueue<T>
-
take
Description copied from interface:ConcurrentQueueOnly return w/ a dequeued value. (Might spin continuously)- Specified by:
takein interfaceConcurrentQueue<T>
-
peek
Description copied from interface:ConcurrentQueueReturn the current next value, or null if the queue is empty.- Specified by:
peekin interfaceConcurrentQueue<T>
-