title: modified hello world in Akka - why so many lost messages and dead letters?
body: <p>Complete beginner here in Akka 2.2, trying a modified version of the <a href="http://doc.akka.io/docs/akka/2.2.0/java/hello-world.html" rel="nofollow">Hello World</a>. The modification is that I create 1000 actors instead of one. Running it, I don't get all 1000 hello worlds returned, with this error trace, repeated for several messages:</p>
  
  <blockquote>
    <p>[07/23/2013 22:22:45.924] [Main-akka.actor.default-dispatcher-2]
    [akka://Main/user/app/$Si] Message
    [net.clementlevallois.akkatest.Greeter$Msg] from
    Actor[akka://Main/user/app#1478796310] to
    Actor[akka://Main/user/app/$Si#-1309206213] was not delivered. <a href="http://doc.akka.io/docs/akka/2.2.0/java/hello-world.html" rel="nofollow">1</a>
    dead letters encountered. This logging can be turned off or adjusted
    with configuration settings 'akka.log-dead-letters' and
    'akka.log-dead-letters-during-shutdown'.</p>
  </blockquote>
  
  <p>The two classes:
  </p>
  
  <pre class="lang-java prettyprint-override"><code>public class App extends UntypedActor {
  
      @Override
      public void preStart() {
          // create the greeter actors
          List&lt;ActorRef&gt; actorRefs = new ArrayList();
          for (int i = 0; i &lt; 1000; i++) {
              final ActorRef greeter = getContext().actorOf(Props.create(Greeter.class, i));
              this.getContext().watch(greeter);
              actorRefs.add(greeter);
          }
          // tell it to perform the greeting
          for (ActorRef actorRef : actorRefs) {
              actorRef.tell(Greeter.Msg.GREET, getSelf());
          }
      }
  
      @Override
      public void onReceive(Object msg) {
  
          if (msg instanceof DeadLetter) {
              System.out.println(msg);
          } else if (msg == Greeter.Msg.DONE) {
              // when the greeter is done, stop this actor and with it the application
              getContext().stop(getSelf());
          } else {
              unhandled(msg);
          }
      }
  
  }
  
  
  
  public class Greeter extends UntypedActor {
  
      String input;
  
      public static enum Msg {
          GREET, DONE;
      }
  
      public Greeter(int i) {
          input = String.valueOf(i);
      }
  
      @Override
      public void onReceive(Object msg) {
          if (msg == Msg.GREET) {
              System.out.println("Hello World! " + input);
              getSender().tell(Msg.DONE, getSelf());
          } else {
              unhandled(msg);
          }
      }
  }
  </code></pre>
  
  <p>I would appreciate any help on debugging, and advice on whether creating lists of actors as done here is alright or not.</p>