Skip to content

Commit c32125b

Browse files
authored
Merge pull request scala/scala#6470 from DavidGregory084/bug#10808
Don't suggest using the global EC when an implicit EC cannot be found.
2 parents 9e3cfba + 6f1da25 commit c32125b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

library/src/scala/concurrent/ExecutionContext.scala

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,17 @@ import scala.annotation.implicitNotFound
5454
* Application callback execution can be configured separately.
5555
*/
5656
@implicitNotFound("""Cannot find an implicit ExecutionContext. You might pass
57-
an (implicit ec: ExecutionContext) parameter to your method
58-
or import scala.concurrent.ExecutionContext.Implicits.global.""")
57+
an (implicit ec: ExecutionContext) parameter to your method.
58+
59+
The ExecutionContext is used to configure how and on which
60+
thread pools Futures will run, so the specific ExecutionContext
61+
that is selected is important.
62+
63+
If your application does not define an ExecutionContext elsewhere,
64+
consider using Scala's global ExecutionContext by defining
65+
the following:
66+
67+
implicit val ec = ExecutionContext.global""")
5968
trait ExecutionContext {
6069

6170
/** Runs a block of code on this execution context.

0 commit comments

Comments
 (0)