public abstract class CustomExecutionContext
extends java.lang.Object
implements scala.concurrent.ExecutionContextExecutor
Subclass this to create your own custom execution context, using the full path to the Akka dispatcher.
class MyCustomExecutionContext extends CustomExecutionContext {
// Dependency inject the actorsystem from elsewhere
public MyCustomExecutionContext(ActorSystem actorSystem) {
super(actorSystem, "full.path.to.my-custom-executor");
}
}
Then use your custom execution context where you have blocking operations that require processing
outside of Play's main rendering thread.| Constructor and Description |
|---|
CustomExecutionContext(akka.actor.ActorSystem actorSystem,
java.lang.String name) |
| Modifier and Type | Method and Description |
|---|---|
java.util.concurrent.Executor |
current()
Get this executor associated with the current ClassLoader.
|
void |
execute(java.lang.Runnable command) |
scala.concurrent.ExecutionContext |
prepare() |
void |
reportFailure(java.lang.Throwable cause) |
public CustomExecutionContext(akka.actor.ActorSystem actorSystem,
java.lang.String name)
public scala.concurrent.ExecutionContext prepare()
prepare in interface scala.concurrent.ExecutionContextpublic void execute(java.lang.Runnable command)
execute in interface java.util.concurrent.Executorexecute in interface scala.concurrent.ExecutionContextpublic void reportFailure(java.lang.Throwable cause)
reportFailure in interface scala.concurrent.ExecutionContextpublic java.util.concurrent.Executor current()
Note that the returned executor is only valid for the current ClassLoader. It should be used in a transient fashion, long lived references to it should not be kept.