Note: the following content is available for Play! 2.1.x. For Game! 2.0.4 see nico_ekitos answer.
Interaction with the client can be summarized in the following diagram:

Playing an HTTP handler (built on top of Netty ) lives in its own execution context. When he receives a request, he tries to find the entry point for the applications to call according to the URL (using the conf/routes application files). Currently, only HTTP request headers are loaded into memory.
Then the entry point is called. This is usually an action that loads the remaining body, if any. This happens in a different execution context, on Play! A "custom" execution context defined as Akka's Akka Manager, which can be configured in the conf/application.conf file.
Finally, inside an action, you can make asynchronous calls (for example, to call a web service ). All of these asynchronous calls use the Scala s Future API, so they use the execution context available in the scope of the call site. So you can use Play! user execution context (defined in play.api.libs.concurrent.Execution.defaultContext ).
In general, the game! uses various execution contexts for the following tasks:
- Receive requests (Netty HTTP handler)
- call actions (user execution context).
And you can use any execution context that you want for your asynchronous calculations (including the Play user's execution context!).
The idea is that all user codes use Play by default. user execution context. If you block it, you will not be able to run more user code, but you can continue to do the rest.
If you are doing expansive calculations, I suggest you use a dedicated execution context.
source share