Ey guys, I have been struggling the last days with a question...
So as I understand, when you do something like
in java 8 you would execute myMethod in the common fork join pool, but play! framework execute it in the executor of its default dispatcher. So basically if you are in the thread A of the executor you would execute it on a thread B, BUT you will loose the http context. Play offers us the class HttpExecutionContext that will allows us to provide the executor of the default dispatcher with the http context too...
With this way, we can "jump" from thread B to thread C with CompletableFuture api and move the context to them too.
Now my question is, what happens when we use the WS api? So I have the following code:
CompletationStage<WSResponse> responsePromise = client.url("url").get();
responsePromise.thenApply(response -> myMethod(response)
I think the `get` method is executed async by netty. It returns a CompletationStage... So where am I when I execute this method? Did a jump to another thread of the executor of the default dispatcher? Did I stay in the same thread? Am i in a different pool just created for WS work? Do i have the http context when I do thenApply?