Package com.mackenziehigh.cascade
Interface Cascade.Stage.Actor.Mailbox<I>
- Type Parameters:
I
- is the type of messages that the actor will consume.
- All Known Implementing Classes:
Cascade.ArrayBlockingQueueMailbox
,Cascade.ArrayDequeMailbox
,Cascade.CircularArrayDequeMailbox
,Cascade.ConcurrentLinkedQueueMailbox
,Cascade.LinkedBlockingQueueMailbox
,Cascade.PriorityBlockingQueueMailbox
- Enclosing interface:
- Cascade.Stage.Actor<I,
O>
public static interface Cascade.Stage.Actor.Mailbox<I>
A queue-like (FIFO) data-structure that stores incoming messages.
-
Method Summary
-
Method Details
-
offer
Add a message to the mailbox.- Parameters:
message
- will be added to the mailbox, if possible.- Returns:
- true, only if the message was in-fact added to the mailbox.
-
poll
I poll()Remove a message from the mailbox.If any message is in the mailbox, then this method must return non-null. In other words, a mailbox cannot choose to delay the removal of a message by forcing the caller to call this method again at a later time.
A mailbox can choose to unilaterally drop messages. In other words, a message that was successfully
offer()
-ed to this mailbox may never be returned bypoll()
, at the sole discretion of the mailbox itself.- Returns:
- the message that was removed, or null, if no message was available.
-