Package rx.internal.util.unsafe
Interface MessagePassingQueue<M>
-
- Type Parameters:
M- the event/message type
- All Known Implementing Classes:
ConcurrentCircularArrayQueue,ConcurrentCircularArrayQueueL0Pad,ConcurrentSequencedCircularArrayQueue,MpmcArrayQueue,MpmcArrayQueueConsumerField,MpmcArrayQueueL1Pad,MpmcArrayQueueL2Pad,MpmcArrayQueueProducerField,SpmcArrayQueue,SpmcArrayQueueConsumerField,SpmcArrayQueueL1Pad,SpmcArrayQueueL2Pad,SpmcArrayQueueL3Pad,SpmcArrayQueueMidPad,SpmcArrayQueueProducerField,SpmcArrayQueueProducerIndexCacheField,SpscArrayQueue,SpscArrayQueueColdField,SpscArrayQueueConsumerField,SpscArrayQueueL1Pad,SpscArrayQueueL2Pad,SpscArrayQueueL3Pad,SpscArrayQueueProducerFields
public interface MessagePassingQueue<M>This is a tagging interface for the queues in this library which implement a subset of theQueueinterface sufficient for concurrent message passing.
Message passing queues offer happens before semantics to messages passed through, namely that writes made by the producer before offering the message are visible to the consuming thread after the message has been polled out of the queue.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanisEmpty()This method's accuracy is subject to concurrent modifications happening as the observation is carried out.booleanoffer(M message)Called from a producer thread subject to the restrictions appropriate to the implementation and according to theQueue.offer(Object)interface.Mpeek()Called from the consumer thread subject to the restrictions appropriate to the implementation and according to theQueue.peek()interface.Mpoll()Called from the consumer thread subject to the restrictions appropriate to the implementation and according to theQueue.poll()interface.intsize()This method's accuracy is subject to concurrent modifications happening as the size is estimated and as such is a best effort rather than absolute value.
-
-
-
Method Detail
-
offer
boolean offer(M message)
Called from a producer thread subject to the restrictions appropriate to the implementation and according to theQueue.offer(Object)interface.- Parameters:
message-- Returns:
- true if element was inserted into the queue, false iff full
-
poll
M poll()
Called from the consumer thread subject to the restrictions appropriate to the implementation and according to theQueue.poll()interface.- Returns:
- a message from the queue if one is available, null iff empty
-
peek
M peek()
Called from the consumer thread subject to the restrictions appropriate to the implementation and according to theQueue.peek()interface.- Returns:
- a message from the queue if one is available, null iff empty
-
size
int size()
This method's accuracy is subject to concurrent modifications happening as the size is estimated and as such is a best effort rather than absolute value. For some implementations this method may be O(n) rather than O(1).- Returns:
- number of messages in the queue, between 0 and queue capacity or
Integer.MAX_VALUEif not bounded
-
isEmpty
boolean isEmpty()
This method's accuracy is subject to concurrent modifications happening as the observation is carried out.- Returns:
- true if empty, false otherwise
-
-