Returning CompletionStage from the resource method


Pavel Bucek
 

Dear experts,

as we already stated, we'd like to support returning CompletionStage from the resource mehod, corresponding spec issue is here:

https://github.com/jax-rs/api/issues/551

The only open issue is related to the thread on which the response will be processed (on which will be the "whenComplete" callback invoked").

Markus suggests that it could/should be done on servlet provided thread/executor, but there is no facility which would give as such thread. The case mentioned in the issue comment won't work, because "whenComplete" would be invoked on the thread which completed the CompletionStage (i.e.: there is no magic which would get back the thread, which was already handled over back to the servlet container). We could leave it like that (the application would need to have some thread which will complete the stage anyway) or we can say that container managed thread will be used, if available.

Please let us know if you have any suggestions or comments.

Thanks and regards,
Pavel

Join jaxrs-spec@javaee.groups.io to automatically receive all group messages.