« Return to Thread: Re: Async Lifecycle for JSF without patching JSF

Re: Async Lifecycle for JSF without patching JSF

by Gregw :: Rate this Message:

Reply to Author | View in Thread

Matthias Wessendorf wrote:

> On Wed, Oct 8, 2008 at 3:06 AM, Greg Wilkins <gregw@...> wrote:
>> Bernd,
>>
>> excellent work!
>>
>> this is valuable feedback as there is a push by some to throw out
>> the asynchronous proposal on the basis that it is too complex and
>> will break frameworks.
>
> I have a question.
> Since in async req. processing (arp) not every req is *mapped* to one thread,
> how do ThreadLocals work ? For instance, there is one FacesContext per request
> and it is stored via ThreadLocal.


Matthias,

threadlocals will not work between the suspended and the
resumed request, as they will probably be handled by different
threads.

Instead request attributes are best used to pass state.

However, as the resumed request goes via a filter chain, a
filter could re-establish a thread local for the duration of
the resume handled (in a try{}finally{} like normal).


> I hope that the ARP actually stays in Servlet 3.0;

Well it looks like there will be something.

But there is an alternate proposal now that is a bit more complex.
It sounds simpler (calling requestDispatcher.forward for a suspended
request), but the ability to add wrappers and the need to access the
request outside of servlet scope make things more complex than it
looks at first.

>> this is valuable evidence that framework developers are able to
>> deal with the complexities of suspend and resume.
>>
>> I'll keep you informed as to how the servlet async-API
>> develops.
>
> Jetty 7 is pretty up-to-date, when there new changes, right ?

Jetty 7 is up to date with the proposal as put at JavaOne this year,
plus a few refinements.

There are also some patches in the jetty-7 patch directory that
try out the other proposals


cheers


 « Return to Thread: Re: Async Lifecycle for JSF without patching JSF