Understanding Scala Future andThen

Viewed 2662

I'm trying to use andThen method to register action stages for the future. Like this:

implicit val executionContext = ExecutionContext.global

val f = Future(0)
f.andThen {
  case r => println(r.get + "1")
} andThen {
  case r => println(r.get + "2")
}

Since this method executes asynchronously and does not produce a return value, any non-fatal exceptions thrown will be reported to the ExecutionContext .

What does it mean asynchronously? It means asynchronously to the future execution itself?

1 Answers
Related