myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerald Müllan" <bierbra...@gmail.com>
Subject Re: PhaseListener behaviour
Date Thu, 16 Nov 2006 18:00:35 GMT
Hi,

you have to make sure every time to make a phaseListener thread safe.
Means it is shared by all user among the incoming requests.

A PL for only one user in only one session is not the way it works..

cheers,

Gerald

On 11/16/06, Pfau, Oliver <oliver.pfau@siemens.com> wrote:
> Hi,
>
> I have a phase listener defined in a backing bean constructor:
>
> ...
> LifecycleFactory lifecycleFactory =
> (LifecycleFactory)
> FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
> Lifecycle lifecycle =
> lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
> lifecycle.addPhaseListener(new PhaseListener()
> {
>         public void beforePhase(PhaseEvent event)
>         {
>                 if (event.getPhaseId() == PhaseId.RENDER_RESPONSE)
>                 {
>                         // invoke a method of the backing bean from this
> anonymous class
>                 }
>         }
>
>         public void afterPhase(PhaseEvent event)
>         {
>                 if (event.getPhaseId() == PhaseId.INVOKE_APPLICATION)
>                 {
>                 }
>         }
>
>
>
>         public PhaseId getPhaseId()
>         {
>
>                 return PhaseId.ANY_PHASE;
>
>         }
> });
> ...
>
>
> How does this phase listener work ? I thought the call of the backing
> bean class will only affect the backing bean in the current session. But
> after debug it seems that all backing bean of all users are affected.
> Does someone know the behaviour exactly ?
>
> Thanks,
> Oliver
>
>


-- 
http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Mime
View raw message