Hi guys,

I'm trying to use the new feature of Spring MVC 3.2, the Async Servlets and I found a problem in our application during the tests.

In order to use the same instance of some beans (scope request) across multiple threads, we have implemented a custom scope and replaced the original request scope provided by Spring. Basically, we have a Map in our custom scope implementation, that holds all the request scoped beans, identified by the correlation id of the requests, that is passed across the multiple threads.

In order to do that, and access the beans anywhere, we were storing the correlation id of that request in a ThreadLocal (created in a Servlet Filter) and then passing the id to the children threads and recreating the ThreadLocal in that threads.

Introducing the Async Servlet support, we found a problem when the request get back to a http thread, after the async processing, and the interceptors are being executed, but the ThreadLocal with the correlation id is not restored at that point.

What I'm trying to find, is a way of register a Callback to be executed in the point that Spring is resuming the http thread and we also have access to the Callable/DeferredResult that was executed, to recreate the ThreadLocal with the correlation id.

Could you tell me if there is a way to do that?

Thanks in advance!