akka.actor
Class UntypedActorWithStash

java.lang.Object
  extended by akka.actor.UntypedActor
      extended by akka.actor.UntypedActorWithStash
All Implemented Interfaces:
Actor, Stash

public abstract class UntypedActorWithStash
extends UntypedActor
implements Stash

Actor base class that should be extended to create an actor with a stash.

The stash enables an actor to temporarily stash away messages that can not or should not be handled using the actor's current behavior.

Example:

   public class MyActorWithStash extends UntypedActorWithStash {
     int count = 0;
     public void onReceive(Object msg) {
       if (msg instanceof String) {
         if (count < 0) {
           getSender().tell(new Integer(((String) msg).length()));
         } else if (count == 2) {
           count = -1;
           unstashAll();
         } else {
           count += 1;
           stash();
         }
       }
     }
   }
 


Nested Class Summary
 
Nested classes/interfaces inherited from interface akka.actor.Actor
Actor.emptyBehavior$
 
Constructor Summary
UntypedActorWithStash()
           
 
Method Summary
 
Methods inherited from class akka.actor.UntypedActor
getContext, getSelf, getSender, onReceive, postRestart, postStop, preRestart, preStart, receive, supervisorStrategy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface akka.actor.Stash
capacity, mailbox, postStop, preRestart, stash, theStash, unstashAll
 
Methods inherited from interface akka.actor.Actor
context, noSender, self, sender, unhandled
 

Constructor Detail

UntypedActorWithStash

public UntypedActorWithStash()