Package com.illumon.util.queue
Interface ConcurrentQueue<T>
- Type Parameters:
T
- the contained type
- All Known Implementing Classes:
LockFreeArrayQueue
,SynchronizedLinkedConcurrentQueue
public interface ConcurrentQueue<T>
Common interface for LockFreeArrayQueue and variants.
Forked from
ConcurrentQueue
.-
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 spins_between_yields)
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.
-
Method Details
-
enqueue
Returns false when the queue is full This method should never block (but it may spin for a finite amount of time) -
enqueue
Spins forever until the item can be enqueued. Calls yield() after the number of specified spins. -
dequeue
T dequeue()Returns null when the queue is empty This method should never block (but it may spin for a finite amount of time) -
put
Only return when enqueued. (Might spin continuously) -
take
T take()Only return w/ a dequeued value. (Might spin continuously) -
peek
T peek()Return the current next value, or null if the queue is empty.
-