Package org.jctools.queues.alt
Interface ConcurrentQueue<E>
- Type Parameters:
E
- element type
- All Known Implementing Classes:
ConcurrentQueueFactory.GenericQueue
,MpmcArrayConcurrentQueue
,MpscArrayConcurrentQueue
,SpscArrayConcurrentQueue
public interface ConcurrentQueue<E>
A minimal top level queue interface which allows producer/consumers access via separate interfaces.
-
Method Details
-
consumer
ConcurrentQueueConsumer<E> consumer()- Returns:
- a consumer instance to be used from a consuming thread.
-
producer
ConcurrentQueueProducer<E> producer()- Returns:
- a producer instance to be used from a producing thread.
-
size
int size()This method may be O(n) or O(1) and may not be accurate.- Returns:
- the number of elements in the queue
-
capacity
int capacity()- Returns:
- the maximum number of elements that can fit in this queue, or -1 if unbounded.
-