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
| Edit this page View SourceAbstractStash(IActorContext)
Declaration
protected AbstractStash(IActorContext context)
Parameters
Type | Name | Description |
---|---|---|
IActorContext | context |
Properties
| Edit this page 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 |
---|---|
int |
Remarks
If capacity is negative, then we're using an Unbounded stash.
Count
The number of messages currently inside the stash.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int |
IsEmpty
Returns true
when Count is zero.
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
bool |
IsFull
When using a bounded stash, this returns true
when the stash is full.
Declaration
public bool IsFull { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
Always returns false
when using an unbounded stash.
NonEmpty
Returns true
when Count is greater than zero.
Declaration
public bool NonEmpty { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
| Edit this page 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.
The unstashed message is guaranteed to be removed from the stash regardless if the Unstash() call successfully returns or throws an exception.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.
The stash is guaranteed to be empty after calling UnstashAll().Declaration
public void UnstashAll()
UnstashAll(Func<Envelope, bool>)
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.
The stash is guaranteed to be empty after calling UnstashAll(Func<Envelope, bool>).Declaration
public void UnstashAll(Func<Envelope, bool> filterPredicate)
Parameters
Type | Name | Description |
---|---|---|
Func<Envelope, bool> | filterPredicate | Only stashed messages selected by this predicate are prepended to the mailbox. |