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 T
dequeue()
Returns null when the queue is empty This method should never block (but it may spin for a finite amount of time)boolean
enqueue(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)boolean
enqueue(T new_value, long not_used)
Spins forever until the item can be enqueued.T
peek()
Return the current next value, or null if the queue is empty.void
put(T new_value)
Only return when enqueued.T
take()
Only return w/ a dequeued value.
-
Constructor Details
-
Method Details
-
enqueue
Description copied from interface:ConcurrentQueue
Returns false when the queue is full This method should never block (but it may spin for a finite amount of time)- Specified by:
enqueue
in interfaceConcurrentQueue<T>
-
enqueue
Description copied from interface:ConcurrentQueue
Spins forever until the item can be enqueued. Calls yield() after the number of specified spins.- Specified by:
enqueue
in interfaceConcurrentQueue<T>
-
dequeue
Description copied from interface:ConcurrentQueue
Returns null when the queue is empty This method should never block (but it may spin for a finite amount of time)- Specified by:
dequeue
in interfaceConcurrentQueue<T>
-
put
Description copied from interface:ConcurrentQueue
Only return when enqueued. (Might spin continuously)- Specified by:
put
in interfaceConcurrentQueue<T>
-
take
Description copied from interface:ConcurrentQueue
Only return w/ a dequeued value. (Might spin continuously)- Specified by:
take
in interfaceConcurrentQueue<T>
-
peek
Description copied from interface:ConcurrentQueue
Return the current next value, or null if the queue is empty.- Specified by:
peek
in interfaceConcurrentQueue<T>
-