If I understand correctly, you should be able to use @RequestScoped and ServletScopes to do what you need. There's a transferRequest method that can transfer the scope to a callable that can be called from another thread. If you want to begin a new request scope for non-HTTP contexts, you can also use scopeRequest.
We use the latter internally to scope requests non-HTTP requests, and the former to detach while waiting on blocking calls (and re-attach later). sam On Nov 9, 2013 6:25 PM, "Martin Kersten" <[email protected]> wrote: > Hi there, > > I am not new to Guice but was not using it for quite some years. > Currently I need a custom small web > framework that uses multi-pass document oriented rendering (creating and > manipulating a DOM tree instead > of rendering directly to output). > > I have the scopes PerThread and PerRequest. Those threads / requests are > asynchronous and therefore > can simple be detached and reattached to a worker thread. > > I checked the implementation of the Scopes for the Servlet and the > Singleton. It does looks straight forward > to implement such a detachable solution. > > Also I am using a RequestContext that stores all parts needed to process > (dispatch, model, render etc) a > request. So I simply bind the scopes to use the current request context > bind to the thread. > > Is there anything I have to remember or double check when I just detach > the context meaning replace one > with another or am I free to go ahead? > > > Cheers, > > Martin (Kersten), > Germany > > -- > You received this message because you are subscribed to the Google Groups > "google-guice" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/google-guice. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "google-guice" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-guice. For more options, visit https://groups.google.com/groups/opt_out.
