Top Description Methods
rx.internal.util.unsafe

public Interface MessagePassingQueue<M>

Known Direct Implementers
rx.internal.util.unsafe.ConcurrentCircularArrayQueueL0Pad
Type Parameters
<M>
the event/message type
Imports
java.util.Queue

This is a tagging interface for the queues in this library which implement a subset of the Queue interface 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.
Author
nitsanw

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if empty, false otherwise
isEmpty
()

This method's accuracy is subject to concurrent modifications happening as the observation is carried out.

public boolean

Returns:

true if element was inserted into the queue, false iff full
offer
(M
the Object to enqueue, not null
message
)

Called from a producer thread subject to the restrictions appropriate to the implementation and according to the Queue#offer(Object) interface.

public M

Returns:

a message from the queue if one is available, null iff empty
peek
()

Called from the consumer thread subject to the restrictions appropriate to the implementation and according to the Queue#peek() interface.

public M

Returns:

a message from the queue if one is available, null iff empty
poll
()

Called from the consumer thread subject to the restrictions appropriate to the implementation and according to the Queue#poll() interface.

public int

Returns:

number of messages in the queue, between 0 and queue capacity or Integer#MAX_VALUE if not bounded
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.

Method Detail

isEmptyback to summary
public boolean isEmpty()

This method's accuracy is subject to concurrent modifications happening as the observation is carried out.

Returns:boolean

true if empty, false otherwise

offerback to summary
public boolean offer(M message)

Called from a producer thread subject to the restrictions appropriate to the implementation and according to the Queue#offer(Object) interface.

Parameters
message:M

the Object to enqueue, not null

Returns:boolean

true if element was inserted into the queue, false iff full

peekback to summary
public M peek()

Called from the consumer thread subject to the restrictions appropriate to the implementation and according to the Queue#peek() interface.

Returns:M

a message from the queue if one is available, null iff empty

pollback to summary
public M poll()

Called from the consumer thread subject to the restrictions appropriate to the implementation and according to the Queue#poll() interface.

Returns:M

a message from the queue if one is available, null iff empty

sizeback to summary
public 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:int

number of messages in the queue, between 0 and queue capacity or Integer#MAX_VALUE if not bounded