Hi
We are using Guice 4.1 in out Jetty based web applications. We are exposing APIs through jersey 1.19.3. We are using com.google.inject.servlet.GuiceFilter in our web.xml to intercept all requests. Now we do have couple of request scopes beans defined. Also we have within a single request processing flow multiple thread hops: Main Jetty thread -> FIrst thread -> Second thread. Request scope objects are injected using Provider to classes that are invoked from second thread. So to make that work we wrapped the callable submitted to first thread using ServletScopes.transferRequest. The to transfer scope to second tread we tried wrapping callable submitted to second thread by ServletScopes.transferRequest. Now when this is executed the execution is blocked. When we referred to the javadoc for ServletScopes.transferRequest
"Because request-scoped objects are not typically thread-safe, the callable returned by this method must not be run on a different thread until the current request scope has terminated. The returned callable will block until the current thread has released the request scope."
It is a bit confusing why this is happening only to the second callable. The argument of thread safety can also be made for the first callable.
We are kind of stuck here. Any suggestions on the right approach to propagate scope would help immensely here
Thanks
Ganesh