Class AbstractStash
INTERNAL API
Support class for implementing a stash for an actor instance. A default stash per actor (= user stash) is maintained by this class. Actors that explicitly need other stashes (optionally in addition to and isolated from the user stash) can create new stashes via StashFactory.
Implements
Inherited Members
Namespace: Akka.Actor.Internal
Assembly: Akka.dll
Syntax
public abstract class AbstractStash : IStash
Constructors
| Improve this Doc View SourceAbstractStash(IActorContext)
Declaration
protected AbstractStash(IActorContext context)
Parameters
Type | Name | Description |
---|---|---|
IActorContext | context |
Properties
| Improve this Doc View SourceCapacity
The capacity of the stash. Configured in the actor's mailbox or dispatcher config.
Declaration
public virtual int Capacity { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
If capacity is negative, then we're using an Unbounded stash.
Count
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
Int32 |
IsEmpty
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsFull
Declaration
public bool IsFull { get; }
Property Value
Type | Description |
---|---|
Boolean |
NonEmpty
Declaration
public bool NonEmpty { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceClearStash()
INTERNAL API.
Clears the stash and and returns all envelopes that have not been unstashed.
Declaration
public IEnumerable<Envelope> ClearStash()
Returns
Type | Description |
---|---|
IEnumerable<Envelope> | Previously stashed messages. |
Prepend(IEnumerable<Envelope>)
Prepends others
to this stash. This method is optimized for a large stash and
small others
.
Declaration
public void Prepend(IEnumerable<Envelope> envelopes)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Envelope> | envelopes | TBD |
Stash()
Adds the current message (the message that the actor received last) to the actor's stash.
Declaration
public void Stash()
Exceptions
Type | Condition |
---|---|
IllegalActorStateException | This exception is thrown if we attempt to stash the same message more than once. |
StashOverflowException | This exception is thrown in the event that we're using a BoundedMessageQueue for the IStash and we've exceeded capacity. |
Unstash()
Prepends the oldest message in the stash to the mailbox, and then removes that message from the stash.
Messages from the stash are enqueued to the mailbox until the capacity of the
mailbox (if any) has been reached. In case a bounded mailbox overflows, a
MessageQueueAppendFailedException
is thrown.
Declaration
public void Unstash()
UnstashAll()
Prepends all messages in the stash to the mailbox, and then clears the stash.
Messages from the stash are enqueued to the mailbox until the capacity of the
mailbox(if any) has been reached. In case a bounded mailbox overflows, a
MessageQueueAppendFailedException
is thrown.
Declaration
public void UnstashAll()
UnstashAll(Func<Envelope, Boolean>)
INTERNA API
Prepends selected messages in the stash, applying filterPredicate
, to the
mailbox, and then clears the stash.
Messages from the stash are enqueued to the mailbox until the capacity of the
mailbox(if any) has been reached. In case a bounded mailbox overflows, a
MessageQueueAppendFailedException
is thrown.
Declaration
public void UnstashAll(Func<Envelope, bool> filterPredicate)
Parameters
Type | Name | Description |
---|---|---|
Func<Envelope, Boolean> | filterPredicate | Only stashed messages selected by this predicate are prepended to the mailbox. |