title: Method returning Future[Unit] containing nested future that is expected to complete
body: <p>With this method</p>
  
  <pre><code>def taskA(): Future[Unit] = Future {
  Future {
    print("Starting nested future")
    Thread.sleep(3000)
    print("Finished nested future")
  } 
  print("starting outer future")
  Thread.sleep(1000)
  print("finished outer future")
  }
  </code></pre>
  
  <p>Is it possible to wait for the nested future to complete before actually completing the outer future?
  This is how I execute this program:</p>
  
  <pre><code>print("Starting program")
  val futureA = taskA()
  
  futureA onComplete{
  case Success(_) =&gt; print("future suceeded")
  case Failure(_) =&gt; print("not able to execute future")
  }
  
  Await.result(futureA, Duration.Inf)
  </code></pre>
  
  <p>This is my console output:</p>
  
  <pre><code>15:18:52.357 [main] Starting program
  15:18:52.563 [scala-execution-context-global-13] Starting nested future
  15:18:52.564 [scala-execution-context-global-12] starting outer future
  15:18:53.564 [scala-execution-context-global-12] finished outer future
  15:18:53.566 [scala-execution-context-global-12] future suceeded
  
  Process finished with exit code 0
  </code></pre>