diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-11-19 10:02:27 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-11-19 10:02:27 +1000 |
commit | 1810ac0bf47dcc40cc858f7a3c64356614f98110 (patch) | |
tree | 27a3cf249ba8c07fa08a3967b8dfd5e0a50bc471 /src/library | |
parent | 74046bb943f33dfa6009af0ddfa9e2f7949b1d58 (diff) | |
parent | a6e77f721921d9e2569433761a1e6a4056ae10f8 (diff) | |
download | scala-1810ac0bf47dcc40cc858f7a3c64356614f98110.tar.gz scala-1810ac0bf47dcc40cc858f7a3c64356614f98110.tar.bz2 scala-1810ac0bf47dcc40cc858f7a3c64356614f98110.zip |
Merge pull request #4132 from phaller/ticket/7444
SI-7444 docs: null Executor allowed in ExecutionContext factories
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/concurrent/ExecutionContext.scala | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/library/scala/concurrent/ExecutionContext.scala b/src/library/scala/concurrent/ExecutionContext.scala index 11d3bb8b02..e380c55880 100644 --- a/src/library/scala/concurrent/ExecutionContext.scala +++ b/src/library/scala/concurrent/ExecutionContext.scala @@ -110,8 +110,9 @@ object ExecutionContext { * The explicit global `ExecutionContext`. Invoke `global` when you want to provide the global * `ExecutionContext` explicitly. * - * The default `ExecutionContext` implementation is backed by a port of - * [[http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166-4jdk7docs/java/util/concurrent/ForkJoinPool.html java.util.concurrent.ForkJoinPool]]. + * The default `ExecutionContext` implementation is backed by a work-stealing thread pool. By default, + * the thread pool uses a target number of worker threads equal to the number of + * [[https://docs.oracle.com/javase/8/docs/api/java/lang/Runtime.html#availableProcessors-- available processors]]. * * @return the global `ExecutionContext` */ @@ -122,15 +123,16 @@ object ExecutionContext { * The implicit global `ExecutionContext`. Import `global` when you want to provide the global * `ExecutionContext` implicitly. * - * The default `ExecutionContext` implementation is backed by a port of - * [[http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166-4jdk7docs/java/util/concurrent/ForkJoinPool.html java.util.concurrent.ForkJoinPool]]. + * The default `ExecutionContext` implementation is backed by a work-stealing thread pool. By default, + * the thread pool uses a target number of worker threads equal to the number of + * [[https://docs.oracle.com/javase/8/docs/api/java/lang/Runtime.html#availableProcessors-- available processors]]. */ implicit lazy val global: ExecutionContextExecutor = impl.ExecutionContextImpl.fromExecutor(null: Executor) } /** Creates an `ExecutionContext` from the given `ExecutorService`. * - * @param e the `ExecutorService` to use + * @param e the `ExecutorService` to use. If `null`, a new `ExecutorService` is created with [[http://www.scala-lang.org/api/current/index.html#scala.concurrent.ExecutionContext$@global:scala.concurrent.ExecutionContextExecutor default configuration]]. * @param reporter a function for error reporting * @return the `ExecutionContext` using the given `ExecutorService` */ @@ -147,14 +149,14 @@ object ExecutionContext { * val ec = ExecutionContext.fromExecutorService(Executors.newSingleThreadExecutor()) * }}} * - * @param e the `ExecutorService` to use + * @param e the `ExecutorService` to use. If `null`, a new `ExecutorService` is created with [[http://www.scala-lang.org/api/current/index.html#scala.concurrent.ExecutionContext$@global:scala.concurrent.ExecutionContextExecutor default configuration]]. * @return the `ExecutionContext` using the given `ExecutorService` */ def fromExecutorService(e: ExecutorService): ExecutionContextExecutorService = fromExecutorService(e, defaultReporter) /** Creates an `ExecutionContext` from the given `Executor`. * - * @param e the `Executor` to use + * @param e the `Executor` to use. If `null`, a new `Executor` is created with [[http://www.scala-lang.org/api/current/index.html#scala.concurrent.ExecutionContext$@global:scala.concurrent.ExecutionContextExecutor default configuration]]. * @param reporter a function for error reporting * @return the `ExecutionContext` using the given `Executor` */ @@ -163,7 +165,7 @@ object ExecutionContext { /** Creates an `ExecutionContext` from the given `Executor` with the [[scala.concurrent.ExecutionContext$.defaultReporter default reporter]]. * - * @param e the `Executor` to use + * @param e the `Executor` to use. If `null`, a new `Executor` is created with [[http://www.scala-lang.org/api/current/index.html#scala.concurrent.ExecutionContext$@global:scala.concurrent.ExecutionContextExecutor default configuration]]. * @return the `ExecutionContext` using the given `Executor` */ def fromExecutor(e: Executor): ExecutionContextExecutor = fromExecutor(e, defaultReporter) |