Package akka.dispatch
Class ExecutionContexts
- java.lang.Object
-
- akka.dispatch.ExecutionContexts
-
public class ExecutionContexts extends java.lang.Object
ExecutionContexts is the Java API for ExecutionContexts
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExecutionContexts.sameThreadExecutionContext$
Deprecated.Use ExecutionContexts.parasitic instead.
-
Constructor Summary
Constructors Constructor Description ExecutionContexts()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static scala.concurrent.ExecutionContextExecutor
fromExecutor(java.util.concurrent.Executor executor)
Returns a new ExecutionContextExecutor which will delegate execution to the underlying Executor, and which will use the default error reporter.static scala.concurrent.ExecutionContextExecutor
fromExecutor(java.util.concurrent.Executor executor, Procedure<java.lang.Throwable> errorReporter)
Returns a new ExecutionContextExecutor which will delegate execution to the underlying Executor, and which will use the provided error reporter.static scala.concurrent.ExecutionContextExecutorService
fromExecutorService(java.util.concurrent.ExecutorService executorService)
Returns a new ExecutionContextExecutorService which will delegate execution to the underlying ExecutorService, and which will use the default error reporter.static scala.concurrent.ExecutionContextExecutorService
fromExecutorService(java.util.concurrent.ExecutorService executorService, Procedure<java.lang.Throwable> errorReporter)
Returns a new ExecutionContextExecutorService which will delegate execution to the underlying ExecutorService, and which will use the provided error reporter.static scala.concurrent.ExecutionContextExecutor
global()
static scala.concurrent.ExecutionContext
parasitic()
INTERNAL API
-
-
-
Method Detail
-
fromExecutor
public static scala.concurrent.ExecutionContextExecutor fromExecutor(java.util.concurrent.Executor executor)
Returns a new ExecutionContextExecutor which will delegate execution to the underlying Executor, and which will use the default error reporter.- Parameters:
executor
- the Executor which will be used for the ExecutionContext- Returns:
- a new ExecutionContext
-
fromExecutor
public static scala.concurrent.ExecutionContextExecutor fromExecutor(java.util.concurrent.Executor executor, Procedure<java.lang.Throwable> errorReporter)
Returns a new ExecutionContextExecutor which will delegate execution to the underlying Executor, and which will use the provided error reporter.- Parameters:
executor
- the Executor which will be used for the ExecutionContexterrorReporter
- a Procedure that will log any exceptions passed to it- Returns:
- a new ExecutionContext
-
fromExecutorService
public static scala.concurrent.ExecutionContextExecutorService fromExecutorService(java.util.concurrent.ExecutorService executorService)
Returns a new ExecutionContextExecutorService which will delegate execution to the underlying ExecutorService, and which will use the default error reporter.- Parameters:
executorService
- the ExecutorService which will be used for the ExecutionContext- Returns:
- a new ExecutionContext
-
fromExecutorService
public static scala.concurrent.ExecutionContextExecutorService fromExecutorService(java.util.concurrent.ExecutorService executorService, Procedure<java.lang.Throwable> errorReporter)
Returns a new ExecutionContextExecutorService which will delegate execution to the underlying ExecutorService, and which will use the provided error reporter.- Parameters:
executorService
- the ExecutorService which will be used for the ExecutionContexterrorReporter
- a Procedure that will log any exceptions passed to it- Returns:
- a new ExecutionContext
-
global
public static scala.concurrent.ExecutionContextExecutor global()
- Returns:
- a reference to the global ExecutionContext
-
parasitic
public static scala.concurrent.ExecutionContext parasitic()
INTERNAL APIWARNING: Not A General Purpose ExecutionContext!
This is an execution context which runs everything on the calling thread. It is very useful for actions which are known to be non-blocking and non-throwing in order to save a round-trip to the thread pool.
Once Scala 2.12 is no longer supported this can be dropped in favour of directly using
ExecutionContext.parasitic
-
-