You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Curtiss Howard <cu...@gmail.com> on 2011/04/04 14:29:50 UTC

@PreDestroy on session beans (re MYFACES-3040)

Hi,

I'm having a hard time following the rationale behind MYFACES-3040.  I
think someone was concerned about @PreDestroy getting called twice if
the session was invalidated?

The solution, however, was to eliminate invoking @PreDestroy when the
session is destroyed ALTOGETHER.  This is an entirely incorrect
solution to the problem.  Just make a simple session-scoped bean and
observe how @PreDestroy doesn't get invoked _at all_ when the app is
stopped!  Running the same test in Glassfish would quickly show the
MyFaces behavior to be incorrect.  I think the change needs to be
reverted and some other solution to the original problem should be
devised.  Thoughts?

Thanks,


Curtiss Howard

Re: @PreDestroy on session beans (re MYFACES-3040)

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi

It seems to be the behavior is different between container implementations.

I tested it on jetty and two @PreDestroy are sent. I think it is more a
design flaw
due to inconsistent behavior between different container implementations of
servlet spec.

What do to in this case? At first view, I think we require a specific SPI
interface
that deals with this stuff, just like LifecycleProvider implementation, that
checks
between different container.

Suggestions are welcome.

regards,

Leonardo Uribe

2011/4/4 Curtiss Howard <cu...@gmail.com>

> Hi,
>
> I'm having a hard time following the rationale behind MYFACES-3040.  I
> think someone was concerned about @PreDestroy getting called twice if
> the session was invalidated?
>
> The solution, however, was to eliminate invoking @PreDestroy when the
> session is destroyed ALTOGETHER.  This is an entirely incorrect
> solution to the problem.  Just make a simple session-scoped bean and
> observe how @PreDestroy doesn't get invoked _at all_ when the app is
> stopped!  Running the same test in Glassfish would quickly show the
> MyFaces behavior to be incorrect.  I think the change needs to be
> reverted and some other solution to the original problem should be
> devised.  Thoughts?
>
> Thanks,
>
>
> Curtiss Howard
>