async endpoints - clean request thread before its suspended

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

async endpoints - clean request thread before its suspended

Alberto São Marcos
i need to clean up some ThreadLocal states on requesting thread when its
work is done and is about to be _suspended_.

using CXF's/JAXRS async endpoints the thread used to deliver the request to
the server is not necessarily the same thread that is going to be used to
carry the response to the client.
in the tests i've performed, LoggingIn interceptors always run for the
requesting thread. There's no _Phase_ that runs after the user code and
before the thread is suspended. LoggingOut interceptors always run for the
response thread.

more also, AFAIK the available callbacks via the Continuation API or via
the @Suspended AsyncResponse response variable, do not allow to do
something before the thread is suspended.

so, with async rest endpoints, is there any cross-cutting concept (eg. an
interceptor) that enables the user to manipulate the request thread just
before its being suspended?