title: akka combining multiple lists of futures without blocking
body: <p>This question is probably relatively basic to one familiar with akka Futures, so please bear with me.</p>
  
  <p>Assuming I have a hierarchy of akka actors per the following structure:</p>
  
  <pre><code>BigBoss                 (one)
  |___ExecutiveActor      (one)
      |___ManagerActor    (many)
          |___WorkerActor (many)
  </code></pre>
  
  <p>And assuming that each non-BigBoss has internal state in a Status wrapper.</p>
  
  <p>If the BigBoss were to want a <code>List&lt;Status&gt;</code> from all descendants, I can see this being the method:</p>
  
  <pre><code>// inside BigBoss getAllStatuses
  Future&lt;Object&gt; futureStatuses = executive.ask("status", 5000);
  List&lt;Status&gt; = (List&lt;Status&gt;)Await.(futureStatuses, timeout);
  </code></pre>
  
  <p>And after the initial message is propagated to all the way down to Worker, I can see Worker replying to Manager with:</p>
  
  <pre><code>getSender().tell(myStatus);
  </code></pre>
  
  <p>Manager would have a lot of these coming back and want to put them in a list for the Executive as a list of Futures - the above reply being in response to:</p>
  
  <pre><code>// inside Manager getAllStatuses
  List&lt;Future&lt;Object&gt;&gt; statuses =...
  for(Worker w : workers) {
     Future&lt;Object&gt; status = w.ask("status", 5000);
     statuses.add(status);
  }
  
  Future&lt;List&lt;Object&gt;&gt; futureStatuses = sequence(statuses, ...);
  getSender().tell(futureStatuses);
  </code></pre>
  
  <p>The above sequence first converts the Futures into a <code>Future&lt;List&lt;Object&gt;&gt;</code> (which really has statuses in it)</p>
  
  <p>So this is where it starts to get a bit hairy to me.</p>
  
  <p>ExecutiveActor had done this:</p>
  
  <pre><code>for(Manager m : managers) {
     Future&lt;Object&gt; status = m.ask("status", 5000);
     // the above Future would be a Future&lt;Future&lt;List&lt;Object&gt;&gt;
  }
  </code></pre>
  
  <p>So, finally - my questions -</p>
  
  <ol>
  <li><p>How do I reduce the above <code>Future&lt;Future&lt;List&lt;Object&gt;&gt;</code> to a <code>Future&lt;List&lt;Object&gt;&gt;</code> without blocking until BigBoss finally calls Await?</p></li>
  <li><p>Is there a way to retain the Status type throughout this rather than using Object?  I know an UntypedActor cannot send a explicit typed reply, but perhaps there is a cleaner way to express this?</p></li>
  <li><p>Is there any more elegant approach to this entirely that I'm not thinking of?  Did I use Sequence too early, or should I have not used it at all?</p></li>
  </ol>
  
  <p>I am (obviously) using Java - and would prefer not to use TypedActors, but would love all feedback!</p>
  
  <p>Thank you very much for your time-</p>