Package com.mackenziehigh.cascade
Class Cascade.ConcurrentLinkedQueueMailbox<I>
java.lang.Object
com.mackenziehigh.cascade.Cascade.ConcurrentLinkedQueueMailbox<I>
- Type Parameters:
I- is the type of messages that will be stored in the mailbox.
- All Implemented Interfaces:
Cascade.Stage.Actor.Mailbox<I>
- Enclosing interface:
- Cascade
public static final class Cascade.ConcurrentLinkedQueueMailbox<I>
extends Object
implements Cascade.Stage.Actor.Mailbox<I>
A
Mailbox implementation based on a ConcurrentLinkedQueue.-
Method Summary
-
Method Details
-
create
Create a new mailbox.- Type Parameters:
I- is the type of messages that will be stored in the mailbox.- Returns:
- the new mailbox.
-
offer
Add a message to the mailbox.- Specified by:
offerin interfaceCascade.Stage.Actor.Mailbox<I>- Parameters:
message- will be added to the mailbox, if possible.- Returns:
- true, only if the message was in-fact added to the mailbox.
-
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.- Specified by:
pollin interfaceCascade.Stage.Actor.Mailbox<I>- Returns:
- the message that was removed, or null, if no message was available.
-