CustomExecutionContext (Play 3.0.10) (original) (raw)


public abstract class CustomExecutionContext
extends Object
implements scala.concurrent.ExecutionContextExecutor
Provides a custom execution context from an Pekko dispatcher.
Subclass this to create your own custom execution context, using the full path to the Pekko 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.
See Also:
Dispatchers, Thread Pools