Scala uses an ExecutionContext
for some asynchronous things (Futures, Promises). An ExecutionContext can be thought of like a Thread Pool, in which Runnables
can be submitted to be run on one of the threads. (It isn't necessarily always a thread pool, but it tends to be).
The way the ExecutionContext is used is usually to pass it in as an implicit
argument to the function that would use it. You'll often see method signatures like this:
def doAsyncThings(args: Args)(implicit exc: ExecutionContext): Future[Result]
The "doAsyncThings" method will use the implicit exc
that gets passed in to put work onto a separate thread.
To answer your question, the Implicits
imports from the two examples are implicit ExecutionContext instances, which are needed to call the future
and scheduleOnce
methods. For exploratory purposes, it doesn't matter which one you use. The global
one from the scala library contains (iirc) a thread pool with 8 or so threads. I would guess that the play one is similar. Unless you are being extra-careful about which threads do what work, the choice should not affect you.