You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Bernd Bohmann <be...@atanion.com> on 2008/10/07 23:19:57 UTC

Re: Async Lifecycle for JSF without patching JSF

Hello,

I just started an Async Lifecycle module based on the suggestion from
Greg Wilkins

http://wiki.glassfish.java.net/Wiki.jsp?page=AlternateAsyncProposalRebuttal

The module has been tested with MyFaces 1.2.4 and Sun RI 1.2_08 and the
async-jsf-example-webapp from the jetty 7.0.0pre3 version.

http://svn.codehaus.org/jetty/jetty/tags/jetty-7.0.0pre3/modules/examples/async-jsf-example-webapp/

Please look at the code

http://svn.apache.org/repos/asf/myfaces/commons/trunk/myfaces-async-lifecycle/src/main/java/org/apache/myfaces/commons/async/

The common Lifecycle and FacesContext code has been added to the
myfaces-commons-utils artifact.

Note the async Servlet API is not final.

Regards

Bernd


Greg Wilkins schrieb:
> Bernd Bohmann wrote:
>> Hello Greg,
>>
>> I just reviewed your patch for the Mojarra JSF implementation. I think
>> it should be possible to provide an extra artifact for JSF which
>> implements the async support for JSF without patching the
>> implementation. The extra artifact contains a FacesContextFactory and a
>> different Lifecyle for the async case. If you are interested I would try
>> to provide the code as a new module in MyFaces Commons.
> 
> 
> Bernd,
> 
> that would be excellent!  and well timed as well as the servlet-EG
> is in final deliberations about the async API proposals.
> 
> cheers
> 

Re: Async Lifecycle for JSF without patching JSF

Posted by Greg Wilkins <gr...@mortbay.com>.
Matthias Wessendorf wrote:
> On Wed, Oct 8, 2008 at 3:06 AM, Greg Wilkins <gr...@mortbay.com> 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



Re: Async Lifecycle for JSF without patching JSF

Posted by Matthias Wessendorf <ma...@apache.org>.
On Wed, Oct 8, 2008 at 3:06 AM, Greg Wilkins <gr...@mortbay.com> 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.

I hope that the ARP actually stays in Servlet 3.0;

>
> 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 ?

>
> If anybody on this list is on the JSF EG or Portlet EG, then
> I'd be happy to liase with them about the progress of the
> servlet proposals.
>
> thanks
>
>
>
>
> Matthias Wessendorf wrote:
>>
>> side bash...
>>
>> I am not 100% how well the Servlet and JSF EGs are connected, but...
>> wouldn't it be worth to put things like ".isSuspended()" on the
>> ExternalContext
>>
>> => etx.isReqSuspended() ?
>>
>> (also, is there some async stuff on portlet?, I am only aware of of
>> servlet, but I am generally a portlet ignorant)
>>
>> But, Bernd this looks cool
>>
>> -M
>>
>> On Tue, Oct 7, 2008 at 11:19 PM, Bernd Bohmann
>> <be...@atanion.com> wrote:
>>>
>>> Hello,
>>>
>>> I just started an Async Lifecycle module based on the suggestion from
>>> Greg Wilkins
>>>
>>>
>>> http://wiki.glassfish.java.net/Wiki.jsp?page=AlternateAsyncProposalRebuttal
>>>
>>> The module has been tested with MyFaces 1.2.4 and Sun RI 1.2_08 and the
>>> async-jsf-example-webapp from the jetty 7.0.0pre3 version.
>>>
>>>
>>> http://svn.codehaus.org/jetty/jetty/tags/jetty-7.0.0pre3/modules/examples/async-jsf-example-webapp/
>>>
>>> Please look at the code
>>>
>>>
>>> http://svn.apache.org/repos/asf/myfaces/commons/trunk/myfaces-async-lifecycle/src/main/java/org/apache/myfaces/commons/async/
>>>
>>> The common Lifecycle and FacesContext code has been added to the
>>> myfaces-commons-utils artifact.
>>>
>>> Note the async Servlet API is not final.
>>>
>>> Regards
>>>
>>> Bernd
>>>
>>>
>>> Greg Wilkins schrieb:
>>>>
>>>> Bernd Bohmann wrote:
>>>>>
>>>>> Hello Greg,
>>>>>
>>>>> I just reviewed your patch for the Mojarra JSF implementation. I think
>>>>> it should be possible to provide an extra artifact for JSF which
>>>>> implements the async support for JSF without patching the
>>>>> implementation. The extra artifact contains a FacesContextFactory and a
>>>>> different Lifecyle for the async case. If you are interested I would
>>>>> try
>>>>> to provide the code as a new module in MyFaces Commons.
>>>>
>>>> Bernd,
>>>>
>>>> that would be excellent!  and well timed as well as the servlet-EG
>>>> is in final deliberations about the async API proposals.
>>>>
>>>> cheers
>>>>
>>
>>
>>
>
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf

Re: Async Lifecycle for JSF without patching JSF

Posted by Greg Wilkins <gr...@mortbay.com>.
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.

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.

If anybody on this list is on the JSF EG or Portlet EG, then
I'd be happy to liase with them about the progress of the
servlet proposals.

thanks




Matthias Wessendorf wrote:
> side bash...
> 
> I am not 100% how well the Servlet and JSF EGs are connected, but...
> wouldn't it be worth to put things like ".isSuspended()" on the ExternalContext
> 
> => etx.isReqSuspended() ?
> 
> (also, is there some async stuff on portlet?, I am only aware of of
> servlet, but I am generally a portlet ignorant)
> 
> But, Bernd this looks cool
> 
> -M
> 
> On Tue, Oct 7, 2008 at 11:19 PM, Bernd Bohmann
> <be...@atanion.com> wrote:
>> Hello,
>>
>> I just started an Async Lifecycle module based on the suggestion from
>> Greg Wilkins
>>
>> http://wiki.glassfish.java.net/Wiki.jsp?page=AlternateAsyncProposalRebuttal
>>
>> The module has been tested with MyFaces 1.2.4 and Sun RI 1.2_08 and the
>> async-jsf-example-webapp from the jetty 7.0.0pre3 version.
>>
>> http://svn.codehaus.org/jetty/jetty/tags/jetty-7.0.0pre3/modules/examples/async-jsf-example-webapp/
>>
>> Please look at the code
>>
>> http://svn.apache.org/repos/asf/myfaces/commons/trunk/myfaces-async-lifecycle/src/main/java/org/apache/myfaces/commons/async/
>>
>> The common Lifecycle and FacesContext code has been added to the
>> myfaces-commons-utils artifact.
>>
>> Note the async Servlet API is not final.
>>
>> Regards
>>
>> Bernd
>>
>>
>> Greg Wilkins schrieb:
>>> Bernd Bohmann wrote:
>>>> Hello Greg,
>>>>
>>>> I just reviewed your patch for the Mojarra JSF implementation. I think
>>>> it should be possible to provide an extra artifact for JSF which
>>>> implements the async support for JSF without patching the
>>>> implementation. The extra artifact contains a FacesContextFactory and a
>>>> different Lifecyle for the async case. If you are interested I would try
>>>> to provide the code as a new module in MyFaces Commons.
>>>
>>> Bernd,
>>>
>>> that would be excellent!  and well timed as well as the servlet-EG
>>> is in final deliberations about the async API proposals.
>>>
>>> cheers
>>>
> 
> 
> 


Re: Async Lifecycle for JSF without patching JSF

Posted by Matthias Wessendorf <ma...@apache.org>.
side bash...

I am not 100% how well the Servlet and JSF EGs are connected, but...
wouldn't it be worth to put things like ".isSuspended()" on the ExternalContext

=> etx.isReqSuspended() ?

(also, is there some async stuff on portlet?, I am only aware of of
servlet, but I am generally a portlet ignorant)

But, Bernd this looks cool

-M

On Tue, Oct 7, 2008 at 11:19 PM, Bernd Bohmann
<be...@atanion.com> wrote:
> Hello,
>
> I just started an Async Lifecycle module based on the suggestion from
> Greg Wilkins
>
> http://wiki.glassfish.java.net/Wiki.jsp?page=AlternateAsyncProposalRebuttal
>
> The module has been tested with MyFaces 1.2.4 and Sun RI 1.2_08 and the
> async-jsf-example-webapp from the jetty 7.0.0pre3 version.
>
> http://svn.codehaus.org/jetty/jetty/tags/jetty-7.0.0pre3/modules/examples/async-jsf-example-webapp/
>
> Please look at the code
>
> http://svn.apache.org/repos/asf/myfaces/commons/trunk/myfaces-async-lifecycle/src/main/java/org/apache/myfaces/commons/async/
>
> The common Lifecycle and FacesContext code has been added to the
> myfaces-commons-utils artifact.
>
> Note the async Servlet API is not final.
>
> Regards
>
> Bernd
>
>
> Greg Wilkins schrieb:
>> Bernd Bohmann wrote:
>>> Hello Greg,
>>>
>>> I just reviewed your patch for the Mojarra JSF implementation. I think
>>> it should be possible to provide an extra artifact for JSF which
>>> implements the async support for JSF without patching the
>>> implementation. The extra artifact contains a FacesContextFactory and a
>>> different Lifecyle for the async case. If you are interested I would try
>>> to provide the code as a new module in MyFaces Commons.
>>
>>
>> Bernd,
>>
>> that would be excellent!  and well timed as well as the servlet-EG
>> is in final deliberations about the async API proposals.
>>
>> cheers
>>
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf