You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Howard W. Smith, Jr." <sm...@gmail.com> on 2013/10/18 02:53:17 UTC

[MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Hmmm, based on Gerhard's recent response below,

On Thu, Oct 17, 2013 at 7:45 AM, Gerhard Petracek <
gerhard.petracek@gmail.com> wrote:

> @myfaces-core:
> the minimal goal is to be spec. compliant.
>

and JAVASERVERFACES_SPEC_PUBLIC-905[1], I downloaded latest MyFaces 2.2 api
and impl JARs (2013-Oct-17), did some testing, and recognized that MyFaces
2.2 is not invoking @PreDestroy on (CDI) @ViewScoped bean(s) upon session
expiration/invalidate.

Clarification: my test included session.invalidate() instead of (actual)
session expired (via/after session timeout).

will provide test (config, steps and) results in my next response to this
thread.

[1] https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-905

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
On Thu, Oct 17, 2013 at 11:52 PM, Leonardo Uribe <lu...@gmail.com> wrote:

>
> You can check here:
>
> https://builds.apache.org/view/M-R/view/MyFaces/job/myfaces-current22-1/
>
> As soon as the job (#1164) is done, you can take the jars from that
> location (which should be the same).
>
>
wish i had good news/report, but the issue seems to still exist. please see
below.

I took latest myfaces 2.2.0 JARs from repository, dropped in tomee/lib,
started tomee (without dropping a new WAR, since WAR has not changed since
my last test).

tomee started and log included the following:

Oct 18, 2013 10:56:10 AM org.apache.myfaces.config.LogMetaInfUtils
logArtifact
INFO: Artifact 'myfaces-api' was found in version
'2.2.0-20131018.053919-2508' from path
'file:/C:/apache-tomee-plus-1.6.0-SNAPSHOT/lib/myfaces-api-2.2.0-20131018.053919-2508.jar'

Oct 18, 2013 10:56:10 AM org.apache.myfaces.config.LogMetaInfUtils
logArtifact
INFO: Artifact 'myfaces-impl' was found in version
'2.2.0-20131018.054743-2505' from path
'file:/C:/apache-tomee-plus-1.6.0-SNAPSHOT/lib/myfaces-impl-2.2.0-20131018.054743-2505.jar'

Oct 18, 2013 10:56:11 AM org.apache.myfaces.util.ExternalSpecifications
isCDIAvailable
INFO: MyFaces CDI support enabled

Oct 18, 2013 10:56:11 AM
org.apache.myfaces.spi.impl.DefaultInjectionProviderFactory
getInjectionProvider
INFO: Using InjectionProvider
org.apache.myfaces.spi.impl.Tomcat7AnnotationInjectionProvider


Test 1: login user, navigate to page which references CDI @ViewScoped bean,
F5/refresh browser to generate another CDI @ViewScoped bean, and logout
user, which invokes HttpSession.invalidate() via CDI @SessionScoped user
bean; @PreDestroy of CDI @ViewScoped bean was not executed. :(

Oct 18, 2013 10:56:31 AM jsf.users.pf_UsersController loginUser
INFO: administrator logged in at 10/18/2013 10:56 AM

Oct 18, 2013 10:56:49 AM jsf.orders.OrderDocumentBean init
INFO: jsf.orders.OrderDocumentBean@6612072e

Oct 18, 2013 10:56:53 AM jsf.orders.OrderDocumentBean init
INFO: jsf.orders.OrderDocumentBean@5421887b

Oct 18, 2013 10:57:03 AM jsf.users.pf_UsersController logout
INFO: administrator logged out at 10/18/2013 10:57 AM


Test 2: same as test 1, but session expire via 1 minute timeout, same
results (@PreDestroy of CDI @viewScoped bean was not executed)

Oct 18, 2013 10:57:50 AM jsf.users.pf_UsersController loginUser
INFO: administrator logged in at 10/18/2013 10:57 AM

Oct 18, 2013 10:58:01 AM jsf.orders.OrderDocumentBean init
INFO: jsf.orders.OrderDocumentBean@432bb463

Oct 18, 2013 10:58:08 AM jsf.orders.OrderDocumentBean init
INFO: jsf.orders.OrderDocumentBean@7049be5a

Oct 18, 2013 10:59:10 AM jsf.users.pf_UsersController sessionTimeout
INFO: administrator session ended at 10/18/2013 10:59 AM


I know I need to isolate/develop a test case, but not much bandwidth right
now; will, hopefully, develop a test case, ASAP.

just wanted to report my test results.

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
Gerhard, sounds good to me. :)


On Fri, Oct 18, 2013 at 4:22 PM, Gerhard Petracek <
gerhard.petracek@gmail.com> wrote:

> hi howard,
>
> your test confirmed what i saw recently -> we have already what i planned
> to do (the confirmation of the issue).
>
> regards,
> gerhard
>
> http://www.irian.at
>
> Your JSF/JavaEE powerhouse -
> JavaEE Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>
>
>
> 2013/10/18 Howard W. Smith, Jr. <sm...@gmail.com>
>
> > Cool! If your test works against Leonardo's latest changes/fixes, please
> > post/share your test results (and test steps). Thanks!
> >
> >
> > On Fri, Oct 18, 2013 at 3:45 PM, Gerhard Petracek <
> > gerhard.petracek@gmail.com> wrote:
> >
> > > hi howard,
> > >
> > > i just planned a short (re-)test for starting a discussion like this
> one.
> > >
> > > regards,
> > > gerhard
> > >
> > > http://www.irian.at
> > >
> > > Your JSF/JavaEE powerhouse -
> > > JavaEE Consulting, Development and
> > > Courses in English and German
> > >
> > > Professional Support for Apache MyFaces
> > >
> > >
> > > 2013/10/18 Howard W. Smith, Jr. <sm...@gmail.com>
> > >
> > > > Gerhard, you're welcome. since i don't have bandwidth (right now),
> > > > maybe/hopefully, you can develop test case(s) per what we're
> > > > discussing/testing/reporting here...if you have bandwidth to do so.
> :)
> > > >
> > > >
> > > > On Fri, Oct 18, 2013 at 5:14 AM, Gerhard Petracek <
> > > > gerhard.petracek@gmail.com> wrote:
> > > >
> > > > > @howard:
> > > > > that's one of the issues i mentioned during the discussion for
> > > > MYFACES-3797
> > > > > and i was going to test it tomorrow.
> > > > > -> thx for testing it and starting this thread.
> > > > >
> > > > > regards,
> > > > > gerhard
> > > > >
> > > > > http://www.irian.at
> > > > >
> > > > > Your JSF/JavaEE powerhouse -
> > > > > JavaEE Consulting, Development and
> > > > > Courses in English and German
> > > > >
> > > > > Professional Support for Apache MyFaces
> > > > >
> > > > >
> > > > >
> > > > > 2013/10/18 Leonardo Uribe <lu...@gmail.com>
> > > > >
> > > > > > Hi
> > > > > >
> > > > > > You can check here:
> > > > > >
> > > > > >
> > > >
> > https://builds.apache.org/view/M-R/view/MyFaces/job/myfaces-current22-1/
> > > > > >
> > > > > > As soon as the job (#1164) is done, you can take the jars from
> that
> > > > > > location (which should be the same).
> > > > > >
> > > > > > regards,
> > > > > >
> > > > > > Leonardo Uribe
> > > > > >
> > > > > >
> > > > > > 2013/10/17 Howard W. Smith, Jr. <sm...@gmail.com>
> > > > > >
> > > > > > > Okay, that is great. I'm waiting for the following folders to
> be
> > > > > updated
> > > > > > > with the latest version:
> > > > > > >
> > > > > > > 1.
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-api/2.2.0-SNAPSHOT/
> > > > > > >
> > > > > > > 2.
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-impl/2.2.0-SNAPSHOT/
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On Thu, Oct 17, 2013 at 10:47 PM, Leonardo Uribe <
> > lu4242@gmail.com
> > > >
> > > > > > wrote:
> > > > > > >
> > > > > > > > Hi
> > > > > > > >
> > > > > > > > I have found the bug. The problem was caused on a refactor,
> > there
> > > > was
> > > > > > an
> > > > > > > > old code that skip state saving when view map is empty, but
> now
> > > > since
> > > > > > > there
> > > > > > > > is a proxy for that implementing StateHolder, the map can be
> > > empty
> > > > > but
> > > > > > it
> > > > > > > > holds the view scope key. Since with CDI the beans are stored
> > > > > > internally,
> > > > > > > > the map keeps empty but the scope is not, and if the view
> scope
> > > key
> > > > > is
> > > > > > > lost
> > > > > > > > the bean is recreated every time. But the beans are still in
> > > > session,
> > > > > > and
> > > > > > > > with the session timeout bug the final result is @PreDestroy
> is
> > > not
> > > > > > > called.
> > > > > > > >
> > > > > > > > Please try again with the latest code, it should work. And
> > please
> > > > > lets
> > > > > > us
> > > > > > > > know what happened, if it is working or not.
> > > > > > > >
> > > > > > > > regards,
> > > > > > > >
> > > > > > > > Leonardo Uribe
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > 2013/10/17 Leonardo Uribe <lu...@gmail.com>
> > > > > > > >
> > > > > > > > > Hi
> > > > > > > > >
> > > > > > > > > I have committed a fix for the problem with the timeout.
> But
> > > I'm
> > > > > > > curious
> > > > > > > > > about this problem, because I tested this scope and
> > > specifically
> > > > > the
> > > > > > > > > @PreDestroy stuff. It should work. But maybe there is a bug
> > > > > > > somewhere....
> > > > > > > > >
> > > > > > > > > regards,
> > > > > > > > >
> > > > > > > > > Leonardo Uribe
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > 2013/10/17 Howard W. Smith, Jr. <sm...@gmail.com>
> > > > > > > > >
> > > > > > > > >> responses inline below,
> > > > > > > > >>
> > > > > > > > >>
> > > > > > > > >>
> > > > > > > > >> On Thu, Oct 17, 2013 at 9:32 PM, Leonardo Uribe <
> > > > lu4242@gmail.com
> > > > > >
> > > > > > > > wrote:
> > > > > > > > >>
> > > > > > > > >> >
> > > > > > > > >> >     public void onSessionDestroyed()
> > > > > > > > >> >     {
> > > > > > > > >> >         // In CDI case, the best way to deal with this
> is
> > > use
> > > > a
> > > > > > > method
> > > > > > > > >> >         // with @PreDestroy annotation on a session
> scope
> > > bean
> > > > > > > > >> >         // ( ViewScopeBeanHolder.destroyBeans() ). There
> > is
> > > no
> > > > > > need
> > > > > > > > >> >         // to do anything else in this location, but it
> is
> > > > > advised
> > > > > > > > >> >         // in CDI the beans are destroyed at the end of
> > the
> > > > > > request,
> > > > > > > > >> >         // not when invalidateSession() is called.
> > > > > > > > >> >         FacesContext facesContext =
> > > > > > > FacesContext.getCurrentInstance();
> > > > > > > > >> >         if (facesContext != null)
> > > > > > > > >> >         {
> > > > > > > > >> >
> > > > > > > > >> > I suppose what's going on there is in the context the
> > > session
> > > > > > > > >> invalidation
> > > > > > > > >> > is done, FacesContext is null and @PreDestroy is
> ignored.
> > > > > > > > >> >
> > > > > > > > >>
> > > > > > > > >> I can agree with that.
> > > > > > > > >>
> > > > > > > > >>
> > > > > > > > >> >
> > > > > > > > >> > To be clear two questions:
> > > > > > > > >> >
> > > > > > > > >> > 1. Is manual session expiration working ? I suppose yes.
> > > > > > > > >> >
> > > > > > > > >>
> > > > > > > > >> hmmm does manual session expiration ==
> > > HttpSession.invalidate()?
> > > > > > > > >>
> > > > > > > > >> When user click Logout button, my app execute/triggers
> > > > > > > > >> HttpSession.invalidate(), and @PreDestroy (on CDI
> > @ViewScoped
> > > > > bean)
> > > > > > is
> > > > > > > > not
> > > > > > > > >> executed.
> > > > > > > > >>
> > > > > > > > >>
> > > > > > > > >>
> > > > > > > > >> > 2. Is session invalidation by a timeout working ? I
> > suppose
> > > > no.
> > > > > > > > >> >
> > > > > > > > >>
> > > > > > > > >> correct, I just verified that in my app. see below.
> > > > > > > > >>
> > > > > > > > >> - navigated to page that reference CDI @ViewScoped bean,
> > > > > > > @PostConstruct
> > > > > > > > >> (below) executed
> > > > > > > > >>
> > > > > > > > >> Oct 17, 2013 9:45:18 PM jsf.orders.OrderDocumentBean init
> > > > > > > > >> INFO: jsf.orders.OrderDocumentBean@a9faef9
> > > > > > > > >>
> > > > > > > > >> changed web.xml, session timeout = 1 minute, so tomee
> ended
> > > > > session
> > > > > > > > >> via/after timeout, and @PreDestroy on CDI @SessionScoped
> > > (below)
> > > > > > > > executed,
> > > > > > > > >>
> > > > > > > > >> Oct 17, 2013 9:45:53 PM jsf.users.pf_UsersController
> > > > > sessionTimeout
> > > > > > > > >> INFO: administrator session ended at 10/17/2013 09:45 PM
> > > > > > > > >>
> > > > > > > > >> but @PreDestroy on CDI @ViewScoped bean was not executed
> > > > > > > > >>
> > > > > > > > >>
> > > > > > > > >> I will try to provide an example to test.
> > > > > > > > >>
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Posted by Gerhard Petracek <ge...@gmail.com>.
hi howard,

your test confirmed what i saw recently -> we have already what i planned
to do (the confirmation of the issue).

regards,
gerhard

http://www.irian.at

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

Professional Support for Apache MyFaces



2013/10/18 Howard W. Smith, Jr. <sm...@gmail.com>

> Cool! If your test works against Leonardo's latest changes/fixes, please
> post/share your test results (and test steps). Thanks!
>
>
> On Fri, Oct 18, 2013 at 3:45 PM, Gerhard Petracek <
> gerhard.petracek@gmail.com> wrote:
>
> > hi howard,
> >
> > i just planned a short (re-)test for starting a discussion like this one.
> >
> > regards,
> > gerhard
> >
> > http://www.irian.at
> >
> > Your JSF/JavaEE powerhouse -
> > JavaEE Consulting, Development and
> > Courses in English and German
> >
> > Professional Support for Apache MyFaces
> >
> >
> > 2013/10/18 Howard W. Smith, Jr. <sm...@gmail.com>
> >
> > > Gerhard, you're welcome. since i don't have bandwidth (right now),
> > > maybe/hopefully, you can develop test case(s) per what we're
> > > discussing/testing/reporting here...if you have bandwidth to do so. :)
> > >
> > >
> > > On Fri, Oct 18, 2013 at 5:14 AM, Gerhard Petracek <
> > > gerhard.petracek@gmail.com> wrote:
> > >
> > > > @howard:
> > > > that's one of the issues i mentioned during the discussion for
> > > MYFACES-3797
> > > > and i was going to test it tomorrow.
> > > > -> thx for testing it and starting this thread.
> > > >
> > > > regards,
> > > > gerhard
> > > >
> > > > http://www.irian.at
> > > >
> > > > Your JSF/JavaEE powerhouse -
> > > > JavaEE Consulting, Development and
> > > > Courses in English and German
> > > >
> > > > Professional Support for Apache MyFaces
> > > >
> > > >
> > > >
> > > > 2013/10/18 Leonardo Uribe <lu...@gmail.com>
> > > >
> > > > > Hi
> > > > >
> > > > > You can check here:
> > > > >
> > > > >
> > >
> https://builds.apache.org/view/M-R/view/MyFaces/job/myfaces-current22-1/
> > > > >
> > > > > As soon as the job (#1164) is done, you can take the jars from that
> > > > > location (which should be the same).
> > > > >
> > > > > regards,
> > > > >
> > > > > Leonardo Uribe
> > > > >
> > > > >
> > > > > 2013/10/17 Howard W. Smith, Jr. <sm...@gmail.com>
> > > > >
> > > > > > Okay, that is great. I'm waiting for the following folders to be
> > > > updated
> > > > > > with the latest version:
> > > > > >
> > > > > > 1.
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-api/2.2.0-SNAPSHOT/
> > > > > >
> > > > > > 2.
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-impl/2.2.0-SNAPSHOT/
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > On Thu, Oct 17, 2013 at 10:47 PM, Leonardo Uribe <
> lu4242@gmail.com
> > >
> > > > > wrote:
> > > > > >
> > > > > > > Hi
> > > > > > >
> > > > > > > I have found the bug. The problem was caused on a refactor,
> there
> > > was
> > > > > an
> > > > > > > old code that skip state saving when view map is empty, but now
> > > since
> > > > > > there
> > > > > > > is a proxy for that implementing StateHolder, the map can be
> > empty
> > > > but
> > > > > it
> > > > > > > holds the view scope key. Since with CDI the beans are stored
> > > > > internally,
> > > > > > > the map keeps empty but the scope is not, and if the view scope
> > key
> > > > is
> > > > > > lost
> > > > > > > the bean is recreated every time. But the beans are still in
> > > session,
> > > > > and
> > > > > > > with the session timeout bug the final result is @PreDestroy is
> > not
> > > > > > called.
> > > > > > >
> > > > > > > Please try again with the latest code, it should work. And
> please
> > > > lets
> > > > > us
> > > > > > > know what happened, if it is working or not.
> > > > > > >
> > > > > > > regards,
> > > > > > >
> > > > > > > Leonardo Uribe
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > 2013/10/17 Leonardo Uribe <lu...@gmail.com>
> > > > > > >
> > > > > > > > Hi
> > > > > > > >
> > > > > > > > I have committed a fix for the problem with the timeout. But
> > I'm
> > > > > > curious
> > > > > > > > about this problem, because I tested this scope and
> > specifically
> > > > the
> > > > > > > > @PreDestroy stuff. It should work. But maybe there is a bug
> > > > > > somewhere....
> > > > > > > >
> > > > > > > > regards,
> > > > > > > >
> > > > > > > > Leonardo Uribe
> > > > > > > >
> > > > > > > >
> > > > > > > > 2013/10/17 Howard W. Smith, Jr. <sm...@gmail.com>
> > > > > > > >
> > > > > > > >> responses inline below,
> > > > > > > >>
> > > > > > > >>
> > > > > > > >>
> > > > > > > >> On Thu, Oct 17, 2013 at 9:32 PM, Leonardo Uribe <
> > > lu4242@gmail.com
> > > > >
> > > > > > > wrote:
> > > > > > > >>
> > > > > > > >> >
> > > > > > > >> >     public void onSessionDestroyed()
> > > > > > > >> >     {
> > > > > > > >> >         // In CDI case, the best way to deal with this is
> > use
> > > a
> > > > > > method
> > > > > > > >> >         // with @PreDestroy annotation on a session scope
> > bean
> > > > > > > >> >         // ( ViewScopeBeanHolder.destroyBeans() ). There
> is
> > no
> > > > > need
> > > > > > > >> >         // to do anything else in this location, but it is
> > > > advised
> > > > > > > >> >         // in CDI the beans are destroyed at the end of
> the
> > > > > request,
> > > > > > > >> >         // not when invalidateSession() is called.
> > > > > > > >> >         FacesContext facesContext =
> > > > > > FacesContext.getCurrentInstance();
> > > > > > > >> >         if (facesContext != null)
> > > > > > > >> >         {
> > > > > > > >> >
> > > > > > > >> > I suppose what's going on there is in the context the
> > session
> > > > > > > >> invalidation
> > > > > > > >> > is done, FacesContext is null and @PreDestroy is ignored.
> > > > > > > >> >
> > > > > > > >>
> > > > > > > >> I can agree with that.
> > > > > > > >>
> > > > > > > >>
> > > > > > > >> >
> > > > > > > >> > To be clear two questions:
> > > > > > > >> >
> > > > > > > >> > 1. Is manual session expiration working ? I suppose yes.
> > > > > > > >> >
> > > > > > > >>
> > > > > > > >> hmmm does manual session expiration ==
> > HttpSession.invalidate()?
> > > > > > > >>
> > > > > > > >> When user click Logout button, my app execute/triggers
> > > > > > > >> HttpSession.invalidate(), and @PreDestroy (on CDI
> @ViewScoped
> > > > bean)
> > > > > is
> > > > > > > not
> > > > > > > >> executed.
> > > > > > > >>
> > > > > > > >>
> > > > > > > >>
> > > > > > > >> > 2. Is session invalidation by a timeout working ? I
> suppose
> > > no.
> > > > > > > >> >
> > > > > > > >>
> > > > > > > >> correct, I just verified that in my app. see below.
> > > > > > > >>
> > > > > > > >> - navigated to page that reference CDI @ViewScoped bean,
> > > > > > @PostConstruct
> > > > > > > >> (below) executed
> > > > > > > >>
> > > > > > > >> Oct 17, 2013 9:45:18 PM jsf.orders.OrderDocumentBean init
> > > > > > > >> INFO: jsf.orders.OrderDocumentBean@a9faef9
> > > > > > > >>
> > > > > > > >> changed web.xml, session timeout = 1 minute, so tomee ended
> > > > session
> > > > > > > >> via/after timeout, and @PreDestroy on CDI @SessionScoped
> > (below)
> > > > > > > executed,
> > > > > > > >>
> > > > > > > >> Oct 17, 2013 9:45:53 PM jsf.users.pf_UsersController
> > > > sessionTimeout
> > > > > > > >> INFO: administrator session ended at 10/17/2013 09:45 PM
> > > > > > > >>
> > > > > > > >> but @PreDestroy on CDI @ViewScoped bean was not executed
> > > > > > > >>
> > > > > > > >>
> > > > > > > >> I will try to provide an example to test.
> > > > > > > >>
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
Cool! If your test works against Leonardo's latest changes/fixes, please
post/share your test results (and test steps). Thanks!


On Fri, Oct 18, 2013 at 3:45 PM, Gerhard Petracek <
gerhard.petracek@gmail.com> wrote:

> hi howard,
>
> i just planned a short (re-)test for starting a discussion like this one.
>
> regards,
> gerhard
>
> http://www.irian.at
>
> Your JSF/JavaEE powerhouse -
> JavaEE Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>
>
> 2013/10/18 Howard W. Smith, Jr. <sm...@gmail.com>
>
> > Gerhard, you're welcome. since i don't have bandwidth (right now),
> > maybe/hopefully, you can develop test case(s) per what we're
> > discussing/testing/reporting here...if you have bandwidth to do so. :)
> >
> >
> > On Fri, Oct 18, 2013 at 5:14 AM, Gerhard Petracek <
> > gerhard.petracek@gmail.com> wrote:
> >
> > > @howard:
> > > that's one of the issues i mentioned during the discussion for
> > MYFACES-3797
> > > and i was going to test it tomorrow.
> > > -> thx for testing it and starting this thread.
> > >
> > > regards,
> > > gerhard
> > >
> > > http://www.irian.at
> > >
> > > Your JSF/JavaEE powerhouse -
> > > JavaEE Consulting, Development and
> > > Courses in English and German
> > >
> > > Professional Support for Apache MyFaces
> > >
> > >
> > >
> > > 2013/10/18 Leonardo Uribe <lu...@gmail.com>
> > >
> > > > Hi
> > > >
> > > > You can check here:
> > > >
> > > >
> > https://builds.apache.org/view/M-R/view/MyFaces/job/myfaces-current22-1/
> > > >
> > > > As soon as the job (#1164) is done, you can take the jars from that
> > > > location (which should be the same).
> > > >
> > > > regards,
> > > >
> > > > Leonardo Uribe
> > > >
> > > >
> > > > 2013/10/17 Howard W. Smith, Jr. <sm...@gmail.com>
> > > >
> > > > > Okay, that is great. I'm waiting for the following folders to be
> > > updated
> > > > > with the latest version:
> > > > >
> > > > > 1.
> > > > >
> > > > >
> > > >
> > >
> >
> https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-api/2.2.0-SNAPSHOT/
> > > > >
> > > > > 2.
> > > > >
> > > > >
> > > >
> > >
> >
> https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-impl/2.2.0-SNAPSHOT/
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Thu, Oct 17, 2013 at 10:47 PM, Leonardo Uribe <lu4242@gmail.com
> >
> > > > wrote:
> > > > >
> > > > > > Hi
> > > > > >
> > > > > > I have found the bug. The problem was caused on a refactor, there
> > was
> > > > an
> > > > > > old code that skip state saving when view map is empty, but now
> > since
> > > > > there
> > > > > > is a proxy for that implementing StateHolder, the map can be
> empty
> > > but
> > > > it
> > > > > > holds the view scope key. Since with CDI the beans are stored
> > > > internally,
> > > > > > the map keeps empty but the scope is not, and if the view scope
> key
> > > is
> > > > > lost
> > > > > > the bean is recreated every time. But the beans are still in
> > session,
> > > > and
> > > > > > with the session timeout bug the final result is @PreDestroy is
> not
> > > > > called.
> > > > > >
> > > > > > Please try again with the latest code, it should work. And please
> > > lets
> > > > us
> > > > > > know what happened, if it is working or not.
> > > > > >
> > > > > > regards,
> > > > > >
> > > > > > Leonardo Uribe
> > > > > >
> > > > > >
> > > > > >
> > > > > > 2013/10/17 Leonardo Uribe <lu...@gmail.com>
> > > > > >
> > > > > > > Hi
> > > > > > >
> > > > > > > I have committed a fix for the problem with the timeout. But
> I'm
> > > > > curious
> > > > > > > about this problem, because I tested this scope and
> specifically
> > > the
> > > > > > > @PreDestroy stuff. It should work. But maybe there is a bug
> > > > > somewhere....
> > > > > > >
> > > > > > > regards,
> > > > > > >
> > > > > > > Leonardo Uribe
> > > > > > >
> > > > > > >
> > > > > > > 2013/10/17 Howard W. Smith, Jr. <sm...@gmail.com>
> > > > > > >
> > > > > > >> responses inline below,
> > > > > > >>
> > > > > > >>
> > > > > > >>
> > > > > > >> On Thu, Oct 17, 2013 at 9:32 PM, Leonardo Uribe <
> > lu4242@gmail.com
> > > >
> > > > > > wrote:
> > > > > > >>
> > > > > > >> >
> > > > > > >> >     public void onSessionDestroyed()
> > > > > > >> >     {
> > > > > > >> >         // In CDI case, the best way to deal with this is
> use
> > a
> > > > > method
> > > > > > >> >         // with @PreDestroy annotation on a session scope
> bean
> > > > > > >> >         // ( ViewScopeBeanHolder.destroyBeans() ). There is
> no
> > > > need
> > > > > > >> >         // to do anything else in this location, but it is
> > > advised
> > > > > > >> >         // in CDI the beans are destroyed at the end of the
> > > > request,
> > > > > > >> >         // not when invalidateSession() is called.
> > > > > > >> >         FacesContext facesContext =
> > > > > FacesContext.getCurrentInstance();
> > > > > > >> >         if (facesContext != null)
> > > > > > >> >         {
> > > > > > >> >
> > > > > > >> > I suppose what's going on there is in the context the
> session
> > > > > > >> invalidation
> > > > > > >> > is done, FacesContext is null and @PreDestroy is ignored.
> > > > > > >> >
> > > > > > >>
> > > > > > >> I can agree with that.
> > > > > > >>
> > > > > > >>
> > > > > > >> >
> > > > > > >> > To be clear two questions:
> > > > > > >> >
> > > > > > >> > 1. Is manual session expiration working ? I suppose yes.
> > > > > > >> >
> > > > > > >>
> > > > > > >> hmmm does manual session expiration ==
> HttpSession.invalidate()?
> > > > > > >>
> > > > > > >> When user click Logout button, my app execute/triggers
> > > > > > >> HttpSession.invalidate(), and @PreDestroy (on CDI @ViewScoped
> > > bean)
> > > > is
> > > > > > not
> > > > > > >> executed.
> > > > > > >>
> > > > > > >>
> > > > > > >>
> > > > > > >> > 2. Is session invalidation by a timeout working ? I suppose
> > no.
> > > > > > >> >
> > > > > > >>
> > > > > > >> correct, I just verified that in my app. see below.
> > > > > > >>
> > > > > > >> - navigated to page that reference CDI @ViewScoped bean,
> > > > > @PostConstruct
> > > > > > >> (below) executed
> > > > > > >>
> > > > > > >> Oct 17, 2013 9:45:18 PM jsf.orders.OrderDocumentBean init
> > > > > > >> INFO: jsf.orders.OrderDocumentBean@a9faef9
> > > > > > >>
> > > > > > >> changed web.xml, session timeout = 1 minute, so tomee ended
> > > session
> > > > > > >> via/after timeout, and @PreDestroy on CDI @SessionScoped
> (below)
> > > > > > executed,
> > > > > > >>
> > > > > > >> Oct 17, 2013 9:45:53 PM jsf.users.pf_UsersController
> > > sessionTimeout
> > > > > > >> INFO: administrator session ended at 10/17/2013 09:45 PM
> > > > > > >>
> > > > > > >> but @PreDestroy on CDI @ViewScoped bean was not executed
> > > > > > >>
> > > > > > >>
> > > > > > >> I will try to provide an example to test.
> > > > > > >>
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Posted by Gerhard Petracek <ge...@gmail.com>.
hi howard,

i just planned a short (re-)test for starting a discussion like this one.

regards,
gerhard

http://www.irian.at

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

Professional Support for Apache MyFaces


2013/10/18 Howard W. Smith, Jr. <sm...@gmail.com>

> Gerhard, you're welcome. since i don't have bandwidth (right now),
> maybe/hopefully, you can develop test case(s) per what we're
> discussing/testing/reporting here...if you have bandwidth to do so. :)
>
>
> On Fri, Oct 18, 2013 at 5:14 AM, Gerhard Petracek <
> gerhard.petracek@gmail.com> wrote:
>
> > @howard:
> > that's one of the issues i mentioned during the discussion for
> MYFACES-3797
> > and i was going to test it tomorrow.
> > -> thx for testing it and starting this thread.
> >
> > regards,
> > gerhard
> >
> > http://www.irian.at
> >
> > Your JSF/JavaEE powerhouse -
> > JavaEE Consulting, Development and
> > Courses in English and German
> >
> > Professional Support for Apache MyFaces
> >
> >
> >
> > 2013/10/18 Leonardo Uribe <lu...@gmail.com>
> >
> > > Hi
> > >
> > > You can check here:
> > >
> > >
> https://builds.apache.org/view/M-R/view/MyFaces/job/myfaces-current22-1/
> > >
> > > As soon as the job (#1164) is done, you can take the jars from that
> > > location (which should be the same).
> > >
> > > regards,
> > >
> > > Leonardo Uribe
> > >
> > >
> > > 2013/10/17 Howard W. Smith, Jr. <sm...@gmail.com>
> > >
> > > > Okay, that is great. I'm waiting for the following folders to be
> > updated
> > > > with the latest version:
> > > >
> > > > 1.
> > > >
> > > >
> > >
> >
> https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-api/2.2.0-SNAPSHOT/
> > > >
> > > > 2.
> > > >
> > > >
> > >
> >
> https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-impl/2.2.0-SNAPSHOT/
> > > >
> > > >
> > > >
> > > >
> > > > On Thu, Oct 17, 2013 at 10:47 PM, Leonardo Uribe <lu...@gmail.com>
> > > wrote:
> > > >
> > > > > Hi
> > > > >
> > > > > I have found the bug. The problem was caused on a refactor, there
> was
> > > an
> > > > > old code that skip state saving when view map is empty, but now
> since
> > > > there
> > > > > is a proxy for that implementing StateHolder, the map can be empty
> > but
> > > it
> > > > > holds the view scope key. Since with CDI the beans are stored
> > > internally,
> > > > > the map keeps empty but the scope is not, and if the view scope key
> > is
> > > > lost
> > > > > the bean is recreated every time. But the beans are still in
> session,
> > > and
> > > > > with the session timeout bug the final result is @PreDestroy is not
> > > > called.
> > > > >
> > > > > Please try again with the latest code, it should work. And please
> > lets
> > > us
> > > > > know what happened, if it is working or not.
> > > > >
> > > > > regards,
> > > > >
> > > > > Leonardo Uribe
> > > > >
> > > > >
> > > > >
> > > > > 2013/10/17 Leonardo Uribe <lu...@gmail.com>
> > > > >
> > > > > > Hi
> > > > > >
> > > > > > I have committed a fix for the problem with the timeout. But I'm
> > > > curious
> > > > > > about this problem, because I tested this scope and specifically
> > the
> > > > > > @PreDestroy stuff. It should work. But maybe there is a bug
> > > > somewhere....
> > > > > >
> > > > > > regards,
> > > > > >
> > > > > > Leonardo Uribe
> > > > > >
> > > > > >
> > > > > > 2013/10/17 Howard W. Smith, Jr. <sm...@gmail.com>
> > > > > >
> > > > > >> responses inline below,
> > > > > >>
> > > > > >>
> > > > > >>
> > > > > >> On Thu, Oct 17, 2013 at 9:32 PM, Leonardo Uribe <
> lu4242@gmail.com
> > >
> > > > > wrote:
> > > > > >>
> > > > > >> >
> > > > > >> >     public void onSessionDestroyed()
> > > > > >> >     {
> > > > > >> >         // In CDI case, the best way to deal with this is use
> a
> > > > method
> > > > > >> >         // with @PreDestroy annotation on a session scope bean
> > > > > >> >         // ( ViewScopeBeanHolder.destroyBeans() ). There is no
> > > need
> > > > > >> >         // to do anything else in this location, but it is
> > advised
> > > > > >> >         // in CDI the beans are destroyed at the end of the
> > > request,
> > > > > >> >         // not when invalidateSession() is called.
> > > > > >> >         FacesContext facesContext =
> > > > FacesContext.getCurrentInstance();
> > > > > >> >         if (facesContext != null)
> > > > > >> >         {
> > > > > >> >
> > > > > >> > I suppose what's going on there is in the context the session
> > > > > >> invalidation
> > > > > >> > is done, FacesContext is null and @PreDestroy is ignored.
> > > > > >> >
> > > > > >>
> > > > > >> I can agree with that.
> > > > > >>
> > > > > >>
> > > > > >> >
> > > > > >> > To be clear two questions:
> > > > > >> >
> > > > > >> > 1. Is manual session expiration working ? I suppose yes.
> > > > > >> >
> > > > > >>
> > > > > >> hmmm does manual session expiration == HttpSession.invalidate()?
> > > > > >>
> > > > > >> When user click Logout button, my app execute/triggers
> > > > > >> HttpSession.invalidate(), and @PreDestroy (on CDI @ViewScoped
> > bean)
> > > is
> > > > > not
> > > > > >> executed.
> > > > > >>
> > > > > >>
> > > > > >>
> > > > > >> > 2. Is session invalidation by a timeout working ? I suppose
> no.
> > > > > >> >
> > > > > >>
> > > > > >> correct, I just verified that in my app. see below.
> > > > > >>
> > > > > >> - navigated to page that reference CDI @ViewScoped bean,
> > > > @PostConstruct
> > > > > >> (below) executed
> > > > > >>
> > > > > >> Oct 17, 2013 9:45:18 PM jsf.orders.OrderDocumentBean init
> > > > > >> INFO: jsf.orders.OrderDocumentBean@a9faef9
> > > > > >>
> > > > > >> changed web.xml, session timeout = 1 minute, so tomee ended
> > session
> > > > > >> via/after timeout, and @PreDestroy on CDI @SessionScoped (below)
> > > > > executed,
> > > > > >>
> > > > > >> Oct 17, 2013 9:45:53 PM jsf.users.pf_UsersController
> > sessionTimeout
> > > > > >> INFO: administrator session ended at 10/17/2013 09:45 PM
> > > > > >>
> > > > > >> but @PreDestroy on CDI @ViewScoped bean was not executed
> > > > > >>
> > > > > >>
> > > > > >> I will try to provide an example to test.
> > > > > >>
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
Gerhard, you're welcome. since i don't have bandwidth (right now),
maybe/hopefully, you can develop test case(s) per what we're
discussing/testing/reporting here...if you have bandwidth to do so. :)


On Fri, Oct 18, 2013 at 5:14 AM, Gerhard Petracek <
gerhard.petracek@gmail.com> wrote:

> @howard:
> that's one of the issues i mentioned during the discussion for MYFACES-3797
> and i was going to test it tomorrow.
> -> thx for testing it and starting this thread.
>
> regards,
> gerhard
>
> http://www.irian.at
>
> Your JSF/JavaEE powerhouse -
> JavaEE Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>
>
>
> 2013/10/18 Leonardo Uribe <lu...@gmail.com>
>
> > Hi
> >
> > You can check here:
> >
> > https://builds.apache.org/view/M-R/view/MyFaces/job/myfaces-current22-1/
> >
> > As soon as the job (#1164) is done, you can take the jars from that
> > location (which should be the same).
> >
> > regards,
> >
> > Leonardo Uribe
> >
> >
> > 2013/10/17 Howard W. Smith, Jr. <sm...@gmail.com>
> >
> > > Okay, that is great. I'm waiting for the following folders to be
> updated
> > > with the latest version:
> > >
> > > 1.
> > >
> > >
> >
> https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-api/2.2.0-SNAPSHOT/
> > >
> > > 2.
> > >
> > >
> >
> https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-impl/2.2.0-SNAPSHOT/
> > >
> > >
> > >
> > >
> > > On Thu, Oct 17, 2013 at 10:47 PM, Leonardo Uribe <lu...@gmail.com>
> > wrote:
> > >
> > > > Hi
> > > >
> > > > I have found the bug. The problem was caused on a refactor, there was
> > an
> > > > old code that skip state saving when view map is empty, but now since
> > > there
> > > > is a proxy for that implementing StateHolder, the map can be empty
> but
> > it
> > > > holds the view scope key. Since with CDI the beans are stored
> > internally,
> > > > the map keeps empty but the scope is not, and if the view scope key
> is
> > > lost
> > > > the bean is recreated every time. But the beans are still in session,
> > and
> > > > with the session timeout bug the final result is @PreDestroy is not
> > > called.
> > > >
> > > > Please try again with the latest code, it should work. And please
> lets
> > us
> > > > know what happened, if it is working or not.
> > > >
> > > > regards,
> > > >
> > > > Leonardo Uribe
> > > >
> > > >
> > > >
> > > > 2013/10/17 Leonardo Uribe <lu...@gmail.com>
> > > >
> > > > > Hi
> > > > >
> > > > > I have committed a fix for the problem with the timeout. But I'm
> > > curious
> > > > > about this problem, because I tested this scope and specifically
> the
> > > > > @PreDestroy stuff. It should work. But maybe there is a bug
> > > somewhere....
> > > > >
> > > > > regards,
> > > > >
> > > > > Leonardo Uribe
> > > > >
> > > > >
> > > > > 2013/10/17 Howard W. Smith, Jr. <sm...@gmail.com>
> > > > >
> > > > >> responses inline below,
> > > > >>
> > > > >>
> > > > >>
> > > > >> On Thu, Oct 17, 2013 at 9:32 PM, Leonardo Uribe <lu4242@gmail.com
> >
> > > > wrote:
> > > > >>
> > > > >> >
> > > > >> >     public void onSessionDestroyed()
> > > > >> >     {
> > > > >> >         // In CDI case, the best way to deal with this is use a
> > > method
> > > > >> >         // with @PreDestroy annotation on a session scope bean
> > > > >> >         // ( ViewScopeBeanHolder.destroyBeans() ). There is no
> > need
> > > > >> >         // to do anything else in this location, but it is
> advised
> > > > >> >         // in CDI the beans are destroyed at the end of the
> > request,
> > > > >> >         // not when invalidateSession() is called.
> > > > >> >         FacesContext facesContext =
> > > FacesContext.getCurrentInstance();
> > > > >> >         if (facesContext != null)
> > > > >> >         {
> > > > >> >
> > > > >> > I suppose what's going on there is in the context the session
> > > > >> invalidation
> > > > >> > is done, FacesContext is null and @PreDestroy is ignored.
> > > > >> >
> > > > >>
> > > > >> I can agree with that.
> > > > >>
> > > > >>
> > > > >> >
> > > > >> > To be clear two questions:
> > > > >> >
> > > > >> > 1. Is manual session expiration working ? I suppose yes.
> > > > >> >
> > > > >>
> > > > >> hmmm does manual session expiration == HttpSession.invalidate()?
> > > > >>
> > > > >> When user click Logout button, my app execute/triggers
> > > > >> HttpSession.invalidate(), and @PreDestroy (on CDI @ViewScoped
> bean)
> > is
> > > > not
> > > > >> executed.
> > > > >>
> > > > >>
> > > > >>
> > > > >> > 2. Is session invalidation by a timeout working ? I suppose no.
> > > > >> >
> > > > >>
> > > > >> correct, I just verified that in my app. see below.
> > > > >>
> > > > >> - navigated to page that reference CDI @ViewScoped bean,
> > > @PostConstruct
> > > > >> (below) executed
> > > > >>
> > > > >> Oct 17, 2013 9:45:18 PM jsf.orders.OrderDocumentBean init
> > > > >> INFO: jsf.orders.OrderDocumentBean@a9faef9
> > > > >>
> > > > >> changed web.xml, session timeout = 1 minute, so tomee ended
> session
> > > > >> via/after timeout, and @PreDestroy on CDI @SessionScoped (below)
> > > > executed,
> > > > >>
> > > > >> Oct 17, 2013 9:45:53 PM jsf.users.pf_UsersController
> sessionTimeout
> > > > >> INFO: administrator session ended at 10/17/2013 09:45 PM
> > > > >>
> > > > >> but @PreDestroy on CDI @ViewScoped bean was not executed
> > > > >>
> > > > >>
> > > > >> I will try to provide an example to test.
> > > > >>
> > > > >
> > > > >
> > > >
> > >
> >
>

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Posted by Gerhard Petracek <ge...@gmail.com>.
@howard:
that's one of the issues i mentioned during the discussion for MYFACES-3797
and i was going to test it tomorrow.
-> thx for testing it and starting this thread.

regards,
gerhard

http://www.irian.at

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

Professional Support for Apache MyFaces



2013/10/18 Leonardo Uribe <lu...@gmail.com>

> Hi
>
> You can check here:
>
> https://builds.apache.org/view/M-R/view/MyFaces/job/myfaces-current22-1/
>
> As soon as the job (#1164) is done, you can take the jars from that
> location (which should be the same).
>
> regards,
>
> Leonardo Uribe
>
>
> 2013/10/17 Howard W. Smith, Jr. <sm...@gmail.com>
>
> > Okay, that is great. I'm waiting for the following folders to be updated
> > with the latest version:
> >
> > 1.
> >
> >
> https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-api/2.2.0-SNAPSHOT/
> >
> > 2.
> >
> >
> https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-impl/2.2.0-SNAPSHOT/
> >
> >
> >
> >
> > On Thu, Oct 17, 2013 at 10:47 PM, Leonardo Uribe <lu...@gmail.com>
> wrote:
> >
> > > Hi
> > >
> > > I have found the bug. The problem was caused on a refactor, there was
> an
> > > old code that skip state saving when view map is empty, but now since
> > there
> > > is a proxy for that implementing StateHolder, the map can be empty but
> it
> > > holds the view scope key. Since with CDI the beans are stored
> internally,
> > > the map keeps empty but the scope is not, and if the view scope key is
> > lost
> > > the bean is recreated every time. But the beans are still in session,
> and
> > > with the session timeout bug the final result is @PreDestroy is not
> > called.
> > >
> > > Please try again with the latest code, it should work. And please lets
> us
> > > know what happened, if it is working or not.
> > >
> > > regards,
> > >
> > > Leonardo Uribe
> > >
> > >
> > >
> > > 2013/10/17 Leonardo Uribe <lu...@gmail.com>
> > >
> > > > Hi
> > > >
> > > > I have committed a fix for the problem with the timeout. But I'm
> > curious
> > > > about this problem, because I tested this scope and specifically the
> > > > @PreDestroy stuff. It should work. But maybe there is a bug
> > somewhere....
> > > >
> > > > regards,
> > > >
> > > > Leonardo Uribe
> > > >
> > > >
> > > > 2013/10/17 Howard W. Smith, Jr. <sm...@gmail.com>
> > > >
> > > >> responses inline below,
> > > >>
> > > >>
> > > >>
> > > >> On Thu, Oct 17, 2013 at 9:32 PM, Leonardo Uribe <lu...@gmail.com>
> > > wrote:
> > > >>
> > > >> >
> > > >> >     public void onSessionDestroyed()
> > > >> >     {
> > > >> >         // In CDI case, the best way to deal with this is use a
> > method
> > > >> >         // with @PreDestroy annotation on a session scope bean
> > > >> >         // ( ViewScopeBeanHolder.destroyBeans() ). There is no
> need
> > > >> >         // to do anything else in this location, but it is advised
> > > >> >         // in CDI the beans are destroyed at the end of the
> request,
> > > >> >         // not when invalidateSession() is called.
> > > >> >         FacesContext facesContext =
> > FacesContext.getCurrentInstance();
> > > >> >         if (facesContext != null)
> > > >> >         {
> > > >> >
> > > >> > I suppose what's going on there is in the context the session
> > > >> invalidation
> > > >> > is done, FacesContext is null and @PreDestroy is ignored.
> > > >> >
> > > >>
> > > >> I can agree with that.
> > > >>
> > > >>
> > > >> >
> > > >> > To be clear two questions:
> > > >> >
> > > >> > 1. Is manual session expiration working ? I suppose yes.
> > > >> >
> > > >>
> > > >> hmmm does manual session expiration == HttpSession.invalidate()?
> > > >>
> > > >> When user click Logout button, my app execute/triggers
> > > >> HttpSession.invalidate(), and @PreDestroy (on CDI @ViewScoped bean)
> is
> > > not
> > > >> executed.
> > > >>
> > > >>
> > > >>
> > > >> > 2. Is session invalidation by a timeout working ? I suppose no.
> > > >> >
> > > >>
> > > >> correct, I just verified that in my app. see below.
> > > >>
> > > >> - navigated to page that reference CDI @ViewScoped bean,
> > @PostConstruct
> > > >> (below) executed
> > > >>
> > > >> Oct 17, 2013 9:45:18 PM jsf.orders.OrderDocumentBean init
> > > >> INFO: jsf.orders.OrderDocumentBean@a9faef9
> > > >>
> > > >> changed web.xml, session timeout = 1 minute, so tomee ended session
> > > >> via/after timeout, and @PreDestroy on CDI @SessionScoped (below)
> > > executed,
> > > >>
> > > >> Oct 17, 2013 9:45:53 PM jsf.users.pf_UsersController sessionTimeout
> > > >> INFO: administrator session ended at 10/17/2013 09:45 PM
> > > >>
> > > >> but @PreDestroy on CDI @ViewScoped bean was not executed
> > > >>
> > > >>
> > > >> I will try to provide an example to test.
> > > >>
> > > >
> > > >
> > >
> >
>

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

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

You can check here:

https://builds.apache.org/view/M-R/view/MyFaces/job/myfaces-current22-1/

As soon as the job (#1164) is done, you can take the jars from that
location (which should be the same).

regards,

Leonardo Uribe


2013/10/17 Howard W. Smith, Jr. <sm...@gmail.com>

> Okay, that is great. I'm waiting for the following folders to be updated
> with the latest version:
>
> 1.
>
> https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-api/2.2.0-SNAPSHOT/
>
> 2.
>
> https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-impl/2.2.0-SNAPSHOT/
>
>
>
>
> On Thu, Oct 17, 2013 at 10:47 PM, Leonardo Uribe <lu...@gmail.com> wrote:
>
> > Hi
> >
> > I have found the bug. The problem was caused on a refactor, there was an
> > old code that skip state saving when view map is empty, but now since
> there
> > is a proxy for that implementing StateHolder, the map can be empty but it
> > holds the view scope key. Since with CDI the beans are stored internally,
> > the map keeps empty but the scope is not, and if the view scope key is
> lost
> > the bean is recreated every time. But the beans are still in session, and
> > with the session timeout bug the final result is @PreDestroy is not
> called.
> >
> > Please try again with the latest code, it should work. And please lets us
> > know what happened, if it is working or not.
> >
> > regards,
> >
> > Leonardo Uribe
> >
> >
> >
> > 2013/10/17 Leonardo Uribe <lu...@gmail.com>
> >
> > > Hi
> > >
> > > I have committed a fix for the problem with the timeout. But I'm
> curious
> > > about this problem, because I tested this scope and specifically the
> > > @PreDestroy stuff. It should work. But maybe there is a bug
> somewhere....
> > >
> > > regards,
> > >
> > > Leonardo Uribe
> > >
> > >
> > > 2013/10/17 Howard W. Smith, Jr. <sm...@gmail.com>
> > >
> > >> responses inline below,
> > >>
> > >>
> > >>
> > >> On Thu, Oct 17, 2013 at 9:32 PM, Leonardo Uribe <lu...@gmail.com>
> > wrote:
> > >>
> > >> >
> > >> >     public void onSessionDestroyed()
> > >> >     {
> > >> >         // In CDI case, the best way to deal with this is use a
> method
> > >> >         // with @PreDestroy annotation on a session scope bean
> > >> >         // ( ViewScopeBeanHolder.destroyBeans() ). There is no need
> > >> >         // to do anything else in this location, but it is advised
> > >> >         // in CDI the beans are destroyed at the end of the request,
> > >> >         // not when invalidateSession() is called.
> > >> >         FacesContext facesContext =
> FacesContext.getCurrentInstance();
> > >> >         if (facesContext != null)
> > >> >         {
> > >> >
> > >> > I suppose what's going on there is in the context the session
> > >> invalidation
> > >> > is done, FacesContext is null and @PreDestroy is ignored.
> > >> >
> > >>
> > >> I can agree with that.
> > >>
> > >>
> > >> >
> > >> > To be clear two questions:
> > >> >
> > >> > 1. Is manual session expiration working ? I suppose yes.
> > >> >
> > >>
> > >> hmmm does manual session expiration == HttpSession.invalidate()?
> > >>
> > >> When user click Logout button, my app execute/triggers
> > >> HttpSession.invalidate(), and @PreDestroy (on CDI @ViewScoped bean) is
> > not
> > >> executed.
> > >>
> > >>
> > >>
> > >> > 2. Is session invalidation by a timeout working ? I suppose no.
> > >> >
> > >>
> > >> correct, I just verified that in my app. see below.
> > >>
> > >> - navigated to page that reference CDI @ViewScoped bean,
> @PostConstruct
> > >> (below) executed
> > >>
> > >> Oct 17, 2013 9:45:18 PM jsf.orders.OrderDocumentBean init
> > >> INFO: jsf.orders.OrderDocumentBean@a9faef9
> > >>
> > >> changed web.xml, session timeout = 1 minute, so tomee ended session
> > >> via/after timeout, and @PreDestroy on CDI @SessionScoped (below)
> > executed,
> > >>
> > >> Oct 17, 2013 9:45:53 PM jsf.users.pf_UsersController sessionTimeout
> > >> INFO: administrator session ended at 10/17/2013 09:45 PM
> > >>
> > >> but @PreDestroy on CDI @ViewScoped bean was not executed
> > >>
> > >>
> > >> I will try to provide an example to test.
> > >>
> > >
> > >
> >
>

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
Okay, that is great. I'm waiting for the following folders to be updated
with the latest version:

1.
https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-api/2.2.0-SNAPSHOT/

2.
https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-impl/2.2.0-SNAPSHOT/




On Thu, Oct 17, 2013 at 10:47 PM, Leonardo Uribe <lu...@gmail.com> wrote:

> Hi
>
> I have found the bug. The problem was caused on a refactor, there was an
> old code that skip state saving when view map is empty, but now since there
> is a proxy for that implementing StateHolder, the map can be empty but it
> holds the view scope key. Since with CDI the beans are stored internally,
> the map keeps empty but the scope is not, and if the view scope key is lost
> the bean is recreated every time. But the beans are still in session, and
> with the session timeout bug the final result is @PreDestroy is not called.
>
> Please try again with the latest code, it should work. And please lets us
> know what happened, if it is working or not.
>
> regards,
>
> Leonardo Uribe
>
>
>
> 2013/10/17 Leonardo Uribe <lu...@gmail.com>
>
> > Hi
> >
> > I have committed a fix for the problem with the timeout. But I'm curious
> > about this problem, because I tested this scope and specifically the
> > @PreDestroy stuff. It should work. But maybe there is a bug somewhere....
> >
> > regards,
> >
> > Leonardo Uribe
> >
> >
> > 2013/10/17 Howard W. Smith, Jr. <sm...@gmail.com>
> >
> >> responses inline below,
> >>
> >>
> >>
> >> On Thu, Oct 17, 2013 at 9:32 PM, Leonardo Uribe <lu...@gmail.com>
> wrote:
> >>
> >> >
> >> >     public void onSessionDestroyed()
> >> >     {
> >> >         // In CDI case, the best way to deal with this is use a method
> >> >         // with @PreDestroy annotation on a session scope bean
> >> >         // ( ViewScopeBeanHolder.destroyBeans() ). There is no need
> >> >         // to do anything else in this location, but it is advised
> >> >         // in CDI the beans are destroyed at the end of the request,
> >> >         // not when invalidateSession() is called.
> >> >         FacesContext facesContext = FacesContext.getCurrentInstance();
> >> >         if (facesContext != null)
> >> >         {
> >> >
> >> > I suppose what's going on there is in the context the session
> >> invalidation
> >> > is done, FacesContext is null and @PreDestroy is ignored.
> >> >
> >>
> >> I can agree with that.
> >>
> >>
> >> >
> >> > To be clear two questions:
> >> >
> >> > 1. Is manual session expiration working ? I suppose yes.
> >> >
> >>
> >> hmmm does manual session expiration == HttpSession.invalidate()?
> >>
> >> When user click Logout button, my app execute/triggers
> >> HttpSession.invalidate(), and @PreDestroy (on CDI @ViewScoped bean) is
> not
> >> executed.
> >>
> >>
> >>
> >> > 2. Is session invalidation by a timeout working ? I suppose no.
> >> >
> >>
> >> correct, I just verified that in my app. see below.
> >>
> >> - navigated to page that reference CDI @ViewScoped bean, @PostConstruct
> >> (below) executed
> >>
> >> Oct 17, 2013 9:45:18 PM jsf.orders.OrderDocumentBean init
> >> INFO: jsf.orders.OrderDocumentBean@a9faef9
> >>
> >> changed web.xml, session timeout = 1 minute, so tomee ended session
> >> via/after timeout, and @PreDestroy on CDI @SessionScoped (below)
> executed,
> >>
> >> Oct 17, 2013 9:45:53 PM jsf.users.pf_UsersController sessionTimeout
> >> INFO: administrator session ended at 10/17/2013 09:45 PM
> >>
> >> but @PreDestroy on CDI @ViewScoped bean was not executed
> >>
> >>
> >> I will try to provide an example to test.
> >>
> >
> >
>

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

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

I have found the bug. The problem was caused on a refactor, there was an
old code that skip state saving when view map is empty, but now since there
is a proxy for that implementing StateHolder, the map can be empty but it
holds the view scope key. Since with CDI the beans are stored internally,
the map keeps empty but the scope is not, and if the view scope key is lost
the bean is recreated every time. But the beans are still in session, and
with the session timeout bug the final result is @PreDestroy is not called.

Please try again with the latest code, it should work. And please lets us
know what happened, if it is working or not.

regards,

Leonardo Uribe



2013/10/17 Leonardo Uribe <lu...@gmail.com>

> Hi
>
> I have committed a fix for the problem with the timeout. But I'm curious
> about this problem, because I tested this scope and specifically the
> @PreDestroy stuff. It should work. But maybe there is a bug somewhere....
>
> regards,
>
> Leonardo Uribe
>
>
> 2013/10/17 Howard W. Smith, Jr. <sm...@gmail.com>
>
>> responses inline below,
>>
>>
>>
>> On Thu, Oct 17, 2013 at 9:32 PM, Leonardo Uribe <lu...@gmail.com> wrote:
>>
>> >
>> >     public void onSessionDestroyed()
>> >     {
>> >         // In CDI case, the best way to deal with this is use a method
>> >         // with @PreDestroy annotation on a session scope bean
>> >         // ( ViewScopeBeanHolder.destroyBeans() ). There is no need
>> >         // to do anything else in this location, but it is advised
>> >         // in CDI the beans are destroyed at the end of the request,
>> >         // not when invalidateSession() is called.
>> >         FacesContext facesContext = FacesContext.getCurrentInstance();
>> >         if (facesContext != null)
>> >         {
>> >
>> > I suppose what's going on there is in the context the session
>> invalidation
>> > is done, FacesContext is null and @PreDestroy is ignored.
>> >
>>
>> I can agree with that.
>>
>>
>> >
>> > To be clear two questions:
>> >
>> > 1. Is manual session expiration working ? I suppose yes.
>> >
>>
>> hmmm does manual session expiration == HttpSession.invalidate()?
>>
>> When user click Logout button, my app execute/triggers
>> HttpSession.invalidate(), and @PreDestroy (on CDI @ViewScoped bean) is not
>> executed.
>>
>>
>>
>> > 2. Is session invalidation by a timeout working ? I suppose no.
>> >
>>
>> correct, I just verified that in my app. see below.
>>
>> - navigated to page that reference CDI @ViewScoped bean, @PostConstruct
>> (below) executed
>>
>> Oct 17, 2013 9:45:18 PM jsf.orders.OrderDocumentBean init
>> INFO: jsf.orders.OrderDocumentBean@a9faef9
>>
>> changed web.xml, session timeout = 1 minute, so tomee ended session
>> via/after timeout, and @PreDestroy on CDI @SessionScoped (below) executed,
>>
>> Oct 17, 2013 9:45:53 PM jsf.users.pf_UsersController sessionTimeout
>> INFO: administrator session ended at 10/17/2013 09:45 PM
>>
>> but @PreDestroy on CDI @ViewScoped bean was not executed
>>
>>
>> I will try to provide an example to test.
>>
>
>

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

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

I have committed a fix for the problem with the timeout. But I'm curious
about this problem, because I tested this scope and specifically the
@PreDestroy stuff. It should work. But maybe there is a bug somewhere....

regards,

Leonardo Uribe


2013/10/17 Howard W. Smith, Jr. <sm...@gmail.com>

> responses inline below,
>
>
> On Thu, Oct 17, 2013 at 9:32 PM, Leonardo Uribe <lu...@gmail.com> wrote:
>
> >
> >     public void onSessionDestroyed()
> >     {
> >         // In CDI case, the best way to deal with this is use a method
> >         // with @PreDestroy annotation on a session scope bean
> >         // ( ViewScopeBeanHolder.destroyBeans() ). There is no need
> >         // to do anything else in this location, but it is advised
> >         // in CDI the beans are destroyed at the end of the request,
> >         // not when invalidateSession() is called.
> >         FacesContext facesContext = FacesContext.getCurrentInstance();
> >         if (facesContext != null)
> >         {
> >
> > I suppose what's going on there is in the context the session
> invalidation
> > is done, FacesContext is null and @PreDestroy is ignored.
> >
>
> I can agree with that.
>
>
> >
> > To be clear two questions:
> >
> > 1. Is manual session expiration working ? I suppose yes.
> >
>
> hmmm does manual session expiration == HttpSession.invalidate()?
>
> When user click Logout button, my app execute/triggers
> HttpSession.invalidate(), and @PreDestroy (on CDI @ViewScoped bean) is not
> executed.
>
>
>
> > 2. Is session invalidation by a timeout working ? I suppose no.
> >
>
> correct, I just verified that in my app. see below.
>
> - navigated to page that reference CDI @ViewScoped bean, @PostConstruct
> (below) executed
>
> Oct 17, 2013 9:45:18 PM jsf.orders.OrderDocumentBean init
> INFO: jsf.orders.OrderDocumentBean@a9faef9
>
> changed web.xml, session timeout = 1 minute, so tomee ended session
> via/after timeout, and @PreDestroy on CDI @SessionScoped (below) executed,
>
> Oct 17, 2013 9:45:53 PM jsf.users.pf_UsersController sessionTimeout
> INFO: administrator session ended at 10/17/2013 09:45 PM
>
> but @PreDestroy on CDI @ViewScoped bean was not executed
>
>
> I will try to provide an example to test.
>

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
responses inline below,


On Thu, Oct 17, 2013 at 9:32 PM, Leonardo Uribe <lu...@gmail.com> wrote:

>
>     public void onSessionDestroyed()
>     {
>         // In CDI case, the best way to deal with this is use a method
>         // with @PreDestroy annotation on a session scope bean
>         // ( ViewScopeBeanHolder.destroyBeans() ). There is no need
>         // to do anything else in this location, but it is advised
>         // in CDI the beans are destroyed at the end of the request,
>         // not when invalidateSession() is called.
>         FacesContext facesContext = FacesContext.getCurrentInstance();
>         if (facesContext != null)
>         {
>
> I suppose what's going on there is in the context the session invalidation
> is done, FacesContext is null and @PreDestroy is ignored.
>

I can agree with that.


>
> To be clear two questions:
>
> 1. Is manual session expiration working ? I suppose yes.
>

hmmm does manual session expiration == HttpSession.invalidate()?

When user click Logout button, my app execute/triggers
HttpSession.invalidate(), and @PreDestroy (on CDI @ViewScoped bean) is not
executed.



> 2. Is session invalidation by a timeout working ? I suppose no.
>

correct, I just verified that in my app. see below.

- navigated to page that reference CDI @ViewScoped bean, @PostConstruct
(below) executed

Oct 17, 2013 9:45:18 PM jsf.orders.OrderDocumentBean init
INFO: jsf.orders.OrderDocumentBean@a9faef9

changed web.xml, session timeout = 1 minute, so tomee ended session
via/after timeout, and @PreDestroy on CDI @SessionScoped (below) executed,

Oct 17, 2013 9:45:53 PM jsf.users.pf_UsersController sessionTimeout
INFO: administrator session ended at 10/17/2013 09:45 PM

but @PreDestroy on CDI @ViewScoped bean was not executed


I will try to provide an example to test.

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

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

Could you please provide an example to test this stuff properly? The
problem in this point is these lines in the javadoc of
javax.faces.view.ViewScope:

"... In the session expiration case, the runtime must ensure that
FacesContext.getCurrentInstance() returns a valid instance if it is called
during the processing of the @PreDestroy annotated method. The set of
methods on FacesContext that are valid to call in this circumstance is
identical to those documented as "valid to call this method during
application startup or shutdown". On the ExternalContext returned from that
FacesContext, all of the methods documented as "valid to call this method
during application startup or shutdown" are valid to call. In addition, the
method ExternalContext.getSessionMap() is also valid to call. ..."

So if we use a @PreDestroy on
org.apache.myfaces.cdi.view.ViewScopeBeanHolder, CDI has the control and we
can't warrant FacesContext to be available. So we had to do the workaround
using ManagedBeanDestroyer (it implement HttpSessionListener). We have this
code:

    public void onSessionDestroyed()
    {
        // In CDI case, the best way to deal with this is use a method
        // with @PreDestroy annotation on a session scope bean
        // ( ViewScopeBeanHolder.destroyBeans() ). There is no need
        // to do anything else in this location, but it is advised
        // in CDI the beans are destroyed at the end of the request,
        // not when invalidateSession() is called.
        FacesContext facesContext = FacesContext.getCurrentInstance();
        if (facesContext != null)
        {

I suppose what's going on there is in the context the session invalidation
is done, FacesContext is null and @PreDestroy is ignored.

To be clear two questions:

1. Is manual session expiration working ? I suppose yes.
2. Is session invalidation by a timeout working ? I suppose no.

regards,

Leonardo Uribe



2013/10/17 Howard W. Smith, Jr. <sm...@gmail.com>

> On Thu, Oct 17, 2013 at 8:53 PM, Howard W. Smith, Jr. <
> smithh032772@gmail.com> wrote:
>
> > Clarification: my test included session.invalidate() instead of (actual)
> > session expired (via/after session timeout).
> >
> > will provide test (config, steps and) results in my next response to this
> > thread.
> >
>
> i tested my app with latest MyFaces 2.2.0 snapshot (2013-Oct-17) with TomEE
> 1.6.0 snapshot (2013-Oct-10; myfaces comitter said that myfaces 2.2.0
> snapshots works with this version of tomee 1.6.0 snapshot),
>
> removed myfaces 2.1.12 JARs from tomee/lib, and dropped myfaces 2.2.0 JARs
> in tomee/lib
>
> modified one of my beans, replaced OmniFaces CDI @ViewScoped with MyFaces
> 2.2.0 CDI @ViewScoped (javax.faces.view.ViewScoped)
>
> generated WAR, deployed WAR to tomee/webapps, started tomee, and started
> test(ing)
>
>
> - navigated to page which references (myfaces 2.2.0 CDI @ViewScoped);
> @PostConstruct executed
>
> Oct 17, 2013 7:33:56 PM jsf.orders.OrderDocumentBean init
> INFO: jsf.orders.OrderDocumentBean@3273c362
>
> - navigated away from that page (action="index.xhtml", non-null outcome);
> @PreDestroy executed
>
> Oct 17, 2013 7:34:30 PM jsf.orders.OrderDocumentBean releaseResources
> INFO: jsf.orders.OrderDocumentBean@3273c362
>
> - navigated to page which references (myfaces 2.2.0 CDI @ViewScoped)
>
> Oct 17, 2013 7:35:22 PM jsf.orders.OrderDocumentBean init
> INFO: jsf.orders.OrderDocumentBean@214e2561
>
> - navigated away from that page (action = null outcome), bean not destroyed
> (of course)
> - navigated to another page (action="index.xhtml", non-null outcome), bean
> destroyed
>
> Oct 17, 2013 7:35:35 PM jsf.orders.OrderDocumentBean releaseResources
> INFO: jsf.orders.OrderDocumentBean@214e2561
>
> - navigated to page which references (myfaces 2.2.0 CDI @ViewScoped)
>
> Oct 17, 2013 7:35:50 PM jsf.orders.OrderDocumentBean init
> INFO: jsf.orders.OrderDocumentBean@28a78a2c
>
> - pressed F5/refresh in Google Chrome, new bean created and page does not
> render data anymore :(
>
> Oct 17, 2013 7:36:11 PM jsf.orders.OrderDocumentBean init
> INFO: jsf.orders.OrderDocumentBean@7af07081
>
> - logged out user (session.invalidate() is executed, @PreDestroy not
> executed to show that the beans were destroyed)
>
> Oct 17, 2013 7:36:39 PM jsf.users.pf_UsersController logout
> INFO: administrator logged out at 10/17/2013 07:36 PM
>
> - but checked jvisualvm (heap dump) and 0/zero/no instances of CDI
> @ViewScoped bean exist
>
> OmniFaces CDI @ViewScoped[1] executes @PreDestroy on session.invalidate()
> and that is what I like/expect, but MyFaces 2.2 CDI @ViewScoped
> implementation is not doing the same.
>
> so, is omnifaces (and mojarra 2.2) CDI @ViewScoped 'spec-compliant', or is
> this an added feature of OmniFaces, to execute @PreDestroy before CDI
> @ViewScoped bean is destroyed on session.invalidate()?
>
>
> [1] https://code.google.com/p/omnifaces/issues/detail?id=201
>

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
Hmmm...

On Fri, Oct 18, 2013 at 11:56 AM, Howard W. Smith, Jr. <
smithh032772@gmail.com> wrote:

> My goal is to communicate/share my actual/expected test results.


More to share below. Earlier, when I tested via 2013-Oct-18 MyFaces 2.2
JARs, exceptions showed up in localhost log, but I just recognized them (in
NetBeans). See exceptions below (there are 3 to 5 exceptions below).


Oct 18, 2013 10:57:23 AM org.apache.catalina.session.StandardSession expire
SEVERE: Session event listener threw exception
java.lang.UnsupportedOperationException: This method is not supported
during shutdown
at
org.apache.myfaces.context.servlet.StartupServletExternalContextImpl.getSessionMap(StartupServletExternalContextImpl.java:205)
at
org.apache.myfaces.cdi.impl.CDIManagedBeanHandlerImpl.isViewScopeBeanHolderCreated(CDIManagedBeanHandlerImpl.java:112)
at
org.apache.myfaces.cdi.impl.CDIManagedBeanHandlerImpl.onSessionDestroyed(CDIManagedBeanHandlerImpl.java:99)
at
org.apache.myfaces.webapp.ManagedBeanDestroyerListener.sessionDestroyed(ManagedBeanDestroyerListener.java:172)
at
org.apache.myfaces.webapp.StartupServletContextListener.sessionDestroyed(StartupServletContextListener.java:369)
at
org.apache.catalina.session.StandardSession.expire(StandardSession.java:806)
at
org.apache.catalina.session.StandardSession.expire(StandardSession.java:742)
at
org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1253)
at
org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:190)
at pf.LoginFilter.doFilter(LoginFilter.java:206)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1686)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)

Oct 18, 2013 10:58:13 AM org.apache.catalina.session.StandardSession expire
SEVERE: Session event listener threw exception
java.lang.UnsupportedOperationException: This method is not supported
during shutdown
at
org.apache.myfaces.context.servlet.StartupServletExternalContextImpl.getSessionMap(StartupServletExternalContextImpl.java:205)
at
org.apache.myfaces.cdi.impl.CDIManagedBeanHandlerImpl.isViewScopeBeanHolderCreated(CDIManagedBeanHandlerImpl.java:112)
at
org.apache.myfaces.cdi.impl.CDIManagedBeanHandlerImpl.onSessionDestroyed(CDIManagedBeanHandlerImpl.java:99)
at
org.apache.myfaces.webapp.ManagedBeanDestroyerListener.sessionDestroyed(ManagedBeanDestroyerListener.java:172)
at
org.apache.myfaces.webapp.StartupServletContextListener.sessionDestroyed(StartupServletContextListener.java:369)
at
org.apache.catalina.session.StandardSession.expire(StandardSession.java:806)
at
org.apache.catalina.session.StandardSession.isValid(StandardSession.java:658)
at
org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:534)
at
org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:519)
at
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1352)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1530)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1519)
at java.lang.Thread.run(Thread.java:724)

Oct 18, 2013 10:59:10 AM org.apache.catalina.session.StandardSession expire
SEVERE: Session event listener threw exception
java.lang.UnsupportedOperationException: This method is not supported
during shutdown
at
org.apache.myfaces.context.servlet.StartupServletExternalContextImpl.getSessionMap(StartupServletExternalContextImpl.java:205)
at
org.apache.myfaces.cdi.impl.CDIManagedBeanHandlerImpl.isViewScopeBeanHolderCreated(CDIManagedBeanHandlerImpl.java:112)
at
org.apache.myfaces.cdi.impl.CDIManagedBeanHandlerImpl.onSessionDestroyed(CDIManagedBeanHandlerImpl.java:99)
at
org.apache.myfaces.webapp.ManagedBeanDestroyerListener.sessionDestroyed(ManagedBeanDestroyerListener.java:172)
at
org.apache.myfaces.webapp.StartupServletContextListener.sessionDestroyed(StartupServletContextListener.java:369)
at
org.apache.catalina.session.StandardSession.expire(StandardSession.java:806)
at
org.apache.catalina.session.StandardSession.isValid(StandardSession.java:658)
at org.apache.catalina.connector.Request.doGetSession(Request.java:2869)
at org.apache.catalina.connector.Request.getSession(Request.java:2316)
at
org.apache.openejb.cdi.CdiAppContextsService.initRequestContext(CdiAppContextsService.java:256)
at
org.apache.openejb.cdi.CdiAppContextsService.startContext(CdiAppContextsService.java:205)
at
org.apache.openejb.server.httpd.BeginWebBeansListener.requestInitialized(BeginWebBeansListener.java:93)
at
org.apache.catalina.core.StandardContext.fireRequestInitEvent(StandardContext.java:6103)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:167)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1686)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)

Oct 18, 2013 5:02:05 PM org.apache.catalina.session.StandardSession expire
SEVERE: Session event listener threw exception
java.lang.UnsupportedOperationException: This method is not supported
during shutdown
at
org.apache.myfaces.context.servlet.StartupServletExternalContextImpl.getSessionMap(StartupServletExternalContextImpl.java:205)
at
org.apache.myfaces.cdi.impl.CDIManagedBeanHandlerImpl.isViewScopeBeanHolderCreated(CDIManagedBeanHandlerImpl.java:112)
at
org.apache.myfaces.cdi.impl.CDIManagedBeanHandlerImpl.onSessionDestroyed(CDIManagedBeanHandlerImpl.java:99)
at
org.apache.myfaces.webapp.ManagedBeanDestroyerListener.sessionDestroyed(ManagedBeanDestroyerListener.java:172)
at
org.apache.myfaces.webapp.StartupServletContextListener.sessionDestroyed(StartupServletContextListener.java:369)
at
org.apache.catalina.session.StandardSession.expire(StandardSession.java:806)
at
org.apache.catalina.session.StandardSession.expire(StandardSession.java:742)
at
org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1253)
at
org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:190)
at pf.LoginFilter.doFilter(LoginFilter.java:206)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1686)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)

Oct 18, 2013 5:02:55 PM org.apache.catalina.session.StandardSession expire
SEVERE: Session event listener threw exception
java.lang.UnsupportedOperationException: This method is not supported
during shutdown
at
org.apache.myfaces.context.servlet.StartupServletExternalContextImpl.getSessionMap(StartupServletExternalContextImpl.java:205)
at
org.apache.myfaces.cdi.impl.CDIManagedBeanHandlerImpl.isViewScopeBeanHolderCreated(CDIManagedBeanHandlerImpl.java:112)
at
org.apache.myfaces.cdi.impl.CDIManagedBeanHandlerImpl.onSessionDestroyed(CDIManagedBeanHandlerImpl.java:99)
at
org.apache.myfaces.webapp.ManagedBeanDestroyerListener.sessionDestroyed(ManagedBeanDestroyerListener.java:172)
at
org.apache.myfaces.webapp.StartupServletContextListener.sessionDestroyed(StartupServletContextListener.java:369)
at
org.apache.catalina.session.StandardSession.expire(StandardSession.java:806)
at
org.apache.catalina.session.StandardSession.isValid(StandardSession.java:658)
at
org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:534)
at
org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:519)
at
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1352)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1530)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1519)
at java.lang.Thread.run(Thread.java:724)

Oct 18, 2013 5:04:18 PM org.apache.catalina.session.StandardSession expire
SEVERE: Session event listener threw exception
java.lang.UnsupportedOperationException: This method is not supported
during shutdown
at
org.apache.myfaces.context.servlet.StartupServletExternalContextImpl.getSessionMap(StartupServletExternalContextImpl.java:205)
at
org.apache.myfaces.cdi.impl.CDIManagedBeanHandlerImpl.isViewScopeBeanHolderCreated(CDIManagedBeanHandlerImpl.java:112)
at
org.apache.myfaces.cdi.impl.CDIManagedBeanHandlerImpl.onSessionDestroyed(CDIManagedBeanHandlerImpl.java:99)
at
org.apache.myfaces.webapp.ManagedBeanDestroyerListener.sessionDestroyed(ManagedBeanDestroyerListener.java:172)
at
org.apache.myfaces.webapp.StartupServletContextListener.sessionDestroyed(StartupServletContextListener.java:369)
at
org.apache.catalina.session.StandardSession.expire(StandardSession.java:806)
at
org.apache.catalina.session.StandardSession.isValid(StandardSession.java:658)
at org.apache.catalina.connector.Request.doGetSession(Request.java:2869)
at org.apache.catalina.connector.Request.getSession(Request.java:2316)
at
org.apache.openejb.cdi.CdiAppContextsService.initRequestContext(CdiAppContextsService.java:256)
at
org.apache.openejb.cdi.CdiAppContextsService.startContext(CdiAppContextsService.java:205)
at
org.apache.openejb.server.httpd.BeginWebBeansListener.requestInitialized(BeginWebBeansListener.java:93)
at
org.apache.catalina.core.StandardContext.fireRequestInitEvent(StandardContext.java:6103)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:167)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1686)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)

Oct 18, 2013 5:15:27 PM org.apache.catalina.session.StandardSession expire
SEVERE: Session event listener threw exception
java.lang.UnsupportedOperationException: This method is not supported
during shutdown
at
org.apache.myfaces.context.servlet.StartupServletExternalContextImpl.getSessionMap(StartupServletExternalContextImpl.java:205)
at
org.apache.myfaces.cdi.impl.CDIManagedBeanHandlerImpl.isViewScopeBeanHolderCreated(CDIManagedBeanHandlerImpl.java:112)
at
org.apache.myfaces.cdi.impl.CDIManagedBeanHandlerImpl.onSessionDestroyed(CDIManagedBeanHandlerImpl.java:99)
at
org.apache.myfaces.webapp.ManagedBeanDestroyerListener.sessionDestroyed(ManagedBeanDestroyerListener.java:172)
at
org.apache.myfaces.webapp.StartupServletContextListener.sessionDestroyed(StartupServletContextListener.java:369)
at
org.apache.catalina.session.StandardSession.expire(StandardSession.java:806)
at
org.apache.catalina.session.StandardSession.isValid(StandardSession.java:658)
at
org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:534)
at
org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:519)
at
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1352)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1530)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1519)
at java.lang.Thread.run(Thread.java:724)

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Posted by Leonardo Uribe <lu...@gmail.com>.
I saw the exception too, and the artifacts attached to the issue already
has the fix for the exception you mention.




2013/10/18 Howard W. Smith, Jr. <sm...@gmail.com>

> Leonardo,
>
> Okay, i will download those artifacts and test and report test results,
> ASAP.
>
> thanks,
> Howard
>
>
> On Fri, Oct 18, 2013 at 5:06 PM, Leonardo Uribe <lu...@gmail.com> wrote:
>
> > Hi Howard
> >
> > It seems something failed in the build, but it was not in the code, it
> was
> > like an interruption on jenkins.
> >
> > I have added the artifacts in:
> >
> > https://issues.apache.org/jira/browse/MYFACES-3747
> >
> >
> >
> https://issues.apache.org/jira/secure/attachment/12609208/myfaces-api-2.2.0-SNAPSHOT.jar
> >
> >
> https://issues.apache.org/jira/secure/attachment/12609209/myfaces-impl-2.2.0-SNAPSHOT.jar
> >
> > please try these artifacts.
> >
> > regards,
> >
> > Leonardo Uribe
> >
> >
> > 2013/10/18 Howard W. Smith, Jr. <sm...@gmail.com>
> >
> > > Leonardo,
> > >
> > > I see myfaces 2.2 api JAR was updated but not myfaces 2.2 impl JAR. Did
> > you
> > > want me to just download the following JAR and retest, or there is
> > > another/later version of the JAR, which is yet to be built?
> > >
> > > myfaces-api-2.2.0-20131018.201520-2509.jar<
> > >
> >
> https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-api/2.2.0-SNAPSHOT/myfaces-api-2.2.0-20131018.201520-2509.jar
> > > >
> > >
> > >
> > > thanks,
> > > Howard
> > >
> > > On Fri, Oct 18, 2013 at 3:05 PM, Leonardo Uribe <lu...@gmail.com>
> > wrote:
> > >
> > > > Hi
> > > >
> > > > I have committed a mixed solution between @PreDestroy annotation and
> > > > ManagedBeanDestroyerListener. The idea is the first one in destroy
> the
> > > > beans wins and the second one is just ignored. I have tested it with
> > both
> > > > configurations, so I hope it will work in your application.
> > > >
> > > > Let us know what happen and thanks Howard for report this. This is
> the
> > > kind
> > > > of help that is very useful for the project in general.
> > > >
> > > > regards,
> > > >
> > > > Leonardo Uribe
> > > >
> > > >
> > > > 2013/10/18 Leonardo Uribe <lu...@gmail.com>
> > > >
> > > > > Hi
> > > > >
> > > > > I was able to reproduce the problem. I have been testing this issue
> > > > > against jetty / weld, and this issue comes when using tomcat / owb
> > > > > configuration. It seems when the session is destroyed,
> > > > > CDIManagedBeanHandlerImpl try to get a reference of
> > ViewScopeBeanHolder
> > > > and
> > > > > FlowScopeBeanHolder, but in that point of time the injection does
> not
> > > > work
> > > > > as you can expect and ViewScopeBeanHolder is recreated.
> > > > >
> > > > > This issue is becoming difficult ...
> > > > >
> > > > > regards,
> > > > >
> > > > > Leonardo Uribe
> > > > >
> > > > >
> > > > >
> > > > > 2013/10/18 Howard W. Smith, Jr. <sm...@gmail.com>
> > > > >
> > > > > On Thu, Oct 17, 2013 at 9:04 PM, Howard W. Smith, Jr. <
> > > > >> smithh032772@gmail.com> wrote:
> > > > >>
> > > > >> > OmniFaces CDI @ViewScoped[1] executes @PreDestroy on
> > > > >> session.invalidate()
> > > > >> > and that is what I like/expect, but MyFaces 2.2 CDI @ViewScoped
> > > > >> > implementation is not doing the same.
> > > > >>
> > > > >>
> > > > >> I am not trying to do any type of cross-forum posting. My goal is
> to
> > > > >> communicate/share my actual/expected test results.
> > > > >>
> > > > >> In production, I am using TomEE 1.6.0 (OWB) + MyFaces 2.1.12 +
> > > OmniFaces
> > > > >> 1.6(.1) CDI @ViewScoped, which invokes @PreDestroy on session
> > > > invalidation
> > > > >> 'and' expiration. Some minutes ago, I did a test against
> production
> > > app,
> > > > >> and just wanted to show you my 'actual test results' of production
> > > > (which)
> > > > >> = 'expected test results' of MyFaces 2.2 CDI @ViewScoped.
> > > > >>
> > > > >> In production, session timeout = 15 minutes, so I did a test
> against
> > > > >> production server, and did the 'same' test as Test 2 (session
> > > > expiration)
> > > > >> in my previous post that included my latest test and test results
> of
> > > > >> MyFaces 2.2 CDI @ViewScoped.
> > > > >>
> > > > >>
> > > > >> Test: login user, navigate to page which references CDI
> @ViewScoped
> > > > bean,
> > > > >> F5/refresh browser to generate another CDI @ViewScoped bean, and
> let
> > > > >> session expire via (15-minute) session timeout; @PreDestroy of
> > > > (OmniFaces)
> > > > >> CDI @ViewScoped bean executed. see below.
> > > > >>
> > > > >> Oct 18, 2013 11:20:29 AM jsf.users.pf_UsersController loginUser
> > > > >> INFO: administrator logged in at 10/18/2013 11:20 AM
> > > > >>
> > > > >> Oct 18, 2013 11:20:39 AM jsf.orders.OrderDocumentBean init
> > > > >> INFO: jsf.orders.OrderDocumentBean@650707eb
> > > > >>
> > > > >> Oct 18, 2013 11:20:42 AM jsf.orders.OrderDocumentBean init
> > > > >> INFO: jsf.orders.OrderDocumentBean@132f168a
> > > > >>
> > > > >> -- session expired --
> > > > >>
> > > > >> Oct 18, 2013 11:35:43 AM jsf.orders.OrderDocumentBean
> > releaseResources
> > > > >> INFO: jsf.orders.OrderDocumentBean@132f168a
> > > > >>
> > > > >> Oct 18, 2013 11:35:43 AM jsf.orders.OrderDocumentBean
> > releaseResources
> > > > >> INFO: jsf.orders.OrderDocumentBean@650707eb
> > > > >>
> > > > >> Oct 18, 2013 11:35:43 AM jsf.users.pf_UsersController
> sessionTimeout
> > > > >> INFO: administrator session ended at 10/18/2013 11:35 AM
> > > > >>
> > > > >
> > > > >
> > > >
> > >
> >
>

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
Leonardo,

Okay, i will download those artifacts and test and report test results,
ASAP.

thanks,
Howard


On Fri, Oct 18, 2013 at 5:06 PM, Leonardo Uribe <lu...@gmail.com> wrote:

> Hi Howard
>
> It seems something failed in the build, but it was not in the code, it was
> like an interruption on jenkins.
>
> I have added the artifacts in:
>
> https://issues.apache.org/jira/browse/MYFACES-3747
>
>
> https://issues.apache.org/jira/secure/attachment/12609208/myfaces-api-2.2.0-SNAPSHOT.jar
>
> https://issues.apache.org/jira/secure/attachment/12609209/myfaces-impl-2.2.0-SNAPSHOT.jar
>
> please try these artifacts.
>
> regards,
>
> Leonardo Uribe
>
>
> 2013/10/18 Howard W. Smith, Jr. <sm...@gmail.com>
>
> > Leonardo,
> >
> > I see myfaces 2.2 api JAR was updated but not myfaces 2.2 impl JAR. Did
> you
> > want me to just download the following JAR and retest, or there is
> > another/later version of the JAR, which is yet to be built?
> >
> > myfaces-api-2.2.0-20131018.201520-2509.jar<
> >
> https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-api/2.2.0-SNAPSHOT/myfaces-api-2.2.0-20131018.201520-2509.jar
> > >
> >
> >
> > thanks,
> > Howard
> >
> > On Fri, Oct 18, 2013 at 3:05 PM, Leonardo Uribe <lu...@gmail.com>
> wrote:
> >
> > > Hi
> > >
> > > I have committed a mixed solution between @PreDestroy annotation and
> > > ManagedBeanDestroyerListener. The idea is the first one in destroy the
> > > beans wins and the second one is just ignored. I have tested it with
> both
> > > configurations, so I hope it will work in your application.
> > >
> > > Let us know what happen and thanks Howard for report this. This is the
> > kind
> > > of help that is very useful for the project in general.
> > >
> > > regards,
> > >
> > > Leonardo Uribe
> > >
> > >
> > > 2013/10/18 Leonardo Uribe <lu...@gmail.com>
> > >
> > > > Hi
> > > >
> > > > I was able to reproduce the problem. I have been testing this issue
> > > > against jetty / weld, and this issue comes when using tomcat / owb
> > > > configuration. It seems when the session is destroyed,
> > > > CDIManagedBeanHandlerImpl try to get a reference of
> ViewScopeBeanHolder
> > > and
> > > > FlowScopeBeanHolder, but in that point of time the injection does not
> > > work
> > > > as you can expect and ViewScopeBeanHolder is recreated.
> > > >
> > > > This issue is becoming difficult ...
> > > >
> > > > regards,
> > > >
> > > > Leonardo Uribe
> > > >
> > > >
> > > >
> > > > 2013/10/18 Howard W. Smith, Jr. <sm...@gmail.com>
> > > >
> > > > On Thu, Oct 17, 2013 at 9:04 PM, Howard W. Smith, Jr. <
> > > >> smithh032772@gmail.com> wrote:
> > > >>
> > > >> > OmniFaces CDI @ViewScoped[1] executes @PreDestroy on
> > > >> session.invalidate()
> > > >> > and that is what I like/expect, but MyFaces 2.2 CDI @ViewScoped
> > > >> > implementation is not doing the same.
> > > >>
> > > >>
> > > >> I am not trying to do any type of cross-forum posting. My goal is to
> > > >> communicate/share my actual/expected test results.
> > > >>
> > > >> In production, I am using TomEE 1.6.0 (OWB) + MyFaces 2.1.12 +
> > OmniFaces
> > > >> 1.6(.1) CDI @ViewScoped, which invokes @PreDestroy on session
> > > invalidation
> > > >> 'and' expiration. Some minutes ago, I did a test against production
> > app,
> > > >> and just wanted to show you my 'actual test results' of production
> > > (which)
> > > >> = 'expected test results' of MyFaces 2.2 CDI @ViewScoped.
> > > >>
> > > >> In production, session timeout = 15 minutes, so I did a test against
> > > >> production server, and did the 'same' test as Test 2 (session
> > > expiration)
> > > >> in my previous post that included my latest test and test results of
> > > >> MyFaces 2.2 CDI @ViewScoped.
> > > >>
> > > >>
> > > >> Test: login user, navigate to page which references CDI @ViewScoped
> > > bean,
> > > >> F5/refresh browser to generate another CDI @ViewScoped bean, and let
> > > >> session expire via (15-minute) session timeout; @PreDestroy of
> > > (OmniFaces)
> > > >> CDI @ViewScoped bean executed. see below.
> > > >>
> > > >> Oct 18, 2013 11:20:29 AM jsf.users.pf_UsersController loginUser
> > > >> INFO: administrator logged in at 10/18/2013 11:20 AM
> > > >>
> > > >> Oct 18, 2013 11:20:39 AM jsf.orders.OrderDocumentBean init
> > > >> INFO: jsf.orders.OrderDocumentBean@650707eb
> > > >>
> > > >> Oct 18, 2013 11:20:42 AM jsf.orders.OrderDocumentBean init
> > > >> INFO: jsf.orders.OrderDocumentBean@132f168a
> > > >>
> > > >> -- session expired --
> > > >>
> > > >> Oct 18, 2013 11:35:43 AM jsf.orders.OrderDocumentBean
> releaseResources
> > > >> INFO: jsf.orders.OrderDocumentBean@132f168a
> > > >>
> > > >> Oct 18, 2013 11:35:43 AM jsf.orders.OrderDocumentBean
> releaseResources
> > > >> INFO: jsf.orders.OrderDocumentBean@650707eb
> > > >>
> > > >> Oct 18, 2013 11:35:43 AM jsf.users.pf_UsersController sessionTimeout
> > > >> INFO: administrator session ended at 10/18/2013 11:35 AM
> > > >>
> > > >
> > > >
> > >
> >
>

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
On Fri, Oct 18, 2013 at 6:01 PM, Howard W. Smith, Jr. <
smithh032772@gmail.com> wrote:

> Based on these test results, @PreDestroy of MyFaces 2.2 CDI @ViewScoped
> bean is executed via session invalidation and expiration. :)
>
> Great work and thank you, Leonardo, Gerhard, and MyFaces team! :)
>

When MyFaces 2.2.x is bundled with TomEE+ (snapshot), hopefully, I will
remember to start using MyFaces 2.2.x CDI @ViewScoped bean. Until then, I
will keep using MyFaces 2.1.12 and OmniFaces CDI @ViewScoped.

i hope to do more MyFaces 2.2 testing, if/when i have bandwidth and/or
use-case to do so. :)

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
On Fri, Oct 18, 2013 at 5:51 PM, Howard W. Smith, Jr. <
smithh032772@gmail.com> wrote:

> i will repeat my test 1 or 2 more times, just to confirm.



Test 1: session invalidation (login, reference @ViewScoped bean, logout,
which does HttpSession.invalidate())

Oct 18, 2013 5:53:45 PM jsf.users.pf_UsersController loginUser
INFO: administrator logged in at 10/18/2013 05:53 PM

Oct 18, 2013 5:55:05 PM jsf.orders.OrderDocumentBean init
INFO: jsf.orders.OrderDocumentBean@4d807a04
Oct 18, 2013 5:55:09 PM jsf.orders.OrderDocumentBean init
INFO: jsf.orders.OrderDocumentBean@3579149

Oct 18, 2013 5:55:15 PM jsf.users.pf_UsersController logout
INFO: administrator logged out at 10/18/2013 05:55 PM

Oct 18, 2013 5:55:15 PM jsf.orders.OrderDocumentBean releaseResources
INFO: jsf.orders.OrderDocumentBean@3579149
Oct 18, 2013 5:55:15 PM jsf.orders.OrderDocumentBean releaseResources
INFO: jsf.orders.OrderDocumentBean@4d807a04


Test 2: session expiration; repeated test steps mentioned in my previous
post

Oct 18, 2013 5:55:45 PM jsf.users.pf_UsersController loginUser
INFO: administrator logged in at 10/18/2013 05:55 PM

Oct 18, 2013 5:55:58 PM jsf.orders.OrderDocumentBean init
INFO: jsf.orders.OrderDocumentBean@2340e3d5
Oct 18, 2013 5:56:01 PM jsf.orders.OrderDocumentBean init
INFO: jsf.orders.OrderDocumentBean@3deaf302
Oct 18, 2013 5:57:01 PM jsf.orders.OrderDocumentBean releaseResources
INFO: jsf.orders.OrderDocumentBean@3deaf302

Oct 18, 2013 5:57:01 PM jsf.orders.OrderDocumentBean releaseResources
INFO: jsf.orders.OrderDocumentBean@2340e3d5
Oct 18, 2013 5:57:01 PM jsf.users.pf_UsersController sessionTimeout
INFO: administrator session ended at 10/18/2013 05:57 PM


Based on these test results, @PreDestroy of MyFaces 2.2 CDI @ViewScoped
bean is executed via session invalidation and expiration. :)

Great work and thank you, Leonardo, Gerhard, and MyFaces team! :)

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
Good news! See (all) below, please :)

On Fri, Oct 18, 2013 at 5:06 PM, Leonardo Uribe <lu...@gmail.com> wrote:

> I have added the artifacts in:
>
> https://issues.apache.org/jira/browse/MYFACES-3747
>
>
> https://issues.apache.org/jira/secure/attachment/12609208/myfaces-api-2.2.0-SNAPSHOT.jar
>
> https://issues.apache.org/jira/secure/attachment/12609209/myfaces-impl-2.2.0-SNAPSHOT.jar
>
> please try these artifacts.
>

Downloaded those artifacts, dropped in tomee/lib, regenerated my WAR (just
in case), dropped WAR in tomee/webapps, started tomee, and the following
showed up in log:

Oct 18, 2013 5:28:47 PM org.apache.myfaces.config.LogMetaInfUtils
logArtifact
INFO: Artifact 'myfaces-api' was found in version '2.2.0-SNAPSHOT' from
path
'file:/C:/apache-tomee-plus-1.6.0-SNAPSHOT/lib/myfaces-api-2.2.0-SNAPSHOT.jar'
Oct 18, 2013 5:28:47 PM org.apache.myfaces.config.LogMetaInfUtils
logArtifact
INFO: Artifact 'myfaces-impl' was found in version '2.2.0-SNAPSHOT' from
path
'file:/C:/apache-tomee-plus-1.6.0-SNAPSHOT/lib/myfaces-impl-2.2.0-SNAPSHOT.jar'
Oct 18, 2013 5:28:47 PM org.apache.myfaces.util.ExternalSpecifications
isCDIAvailable
INFO: MyFaces CDI support enabled
Oct 18, 2013 5:28:47 PM
org.apache.myfaces.spi.impl.DefaultInjectionProviderFactory
getInjectionProvider
INFO: Using InjectionProvider
org.apache.myfaces.spi.impl.Tomcat7AnnotationInjectionProvider

--- logged in (web) app ---

Oct 18, 2013 5:32:24 PM jsf.users.pf_UsersController loginUser
INFO: administrator logged in at 10/18/2013 05:32 PM

--- repeated test steps that I mentioned in earlier responses in this email
thread ---

Oct 18, 2013 5:32:34 PM jsf.orders.OrderDocumentBean init
INFO: jsf.orders.OrderDocumentBean@7db07a20
Oct 18, 2013 5:32:37 PM jsf.orders.OrderDocumentBean init
INFO: jsf.orders.OrderDocumentBean@ab9ec77

--- session expired via 1 minute session timeout, @PreDestroy of MyFaces
2.2 CDI @ViewScoped bean executed ---

Oct 18, 2013 5:33:37 PM jsf.orders.OrderDocumentBean releaseResources
INFO: jsf.orders.OrderDocumentBean@ab9ec77
Oct 18, 2013 5:33:37 PM jsf.orders.OrderDocumentBean releaseResources
INFO: jsf.orders.OrderDocumentBean@7db07a20
Oct 18, 2013 5:33:37 PM jsf.users.pf_UsersController sessionTimeout
INFO: administrator session ended at 10/18/2013 05:33 PM

--- also, no exceptions in localhost log, when shutdown tomee ---

i will repeat my test 1 or 2 more times, just to confirm.

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

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

It seems something failed in the build, but it was not in the code, it was
like an interruption on jenkins.

I have added the artifacts in:

https://issues.apache.org/jira/browse/MYFACES-3747

https://issues.apache.org/jira/secure/attachment/12609208/myfaces-api-2.2.0-SNAPSHOT.jar
https://issues.apache.org/jira/secure/attachment/12609209/myfaces-impl-2.2.0-SNAPSHOT.jar

please try these artifacts.

regards,

Leonardo Uribe


2013/10/18 Howard W. Smith, Jr. <sm...@gmail.com>

> Leonardo,
>
> I see myfaces 2.2 api JAR was updated but not myfaces 2.2 impl JAR. Did you
> want me to just download the following JAR and retest, or there is
> another/later version of the JAR, which is yet to be built?
>
> myfaces-api-2.2.0-20131018.201520-2509.jar<
> https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-api/2.2.0-SNAPSHOT/myfaces-api-2.2.0-20131018.201520-2509.jar
> >
>
>
> thanks,
> Howard
>
> On Fri, Oct 18, 2013 at 3:05 PM, Leonardo Uribe <lu...@gmail.com> wrote:
>
> > Hi
> >
> > I have committed a mixed solution between @PreDestroy annotation and
> > ManagedBeanDestroyerListener. The idea is the first one in destroy the
> > beans wins and the second one is just ignored. I have tested it with both
> > configurations, so I hope it will work in your application.
> >
> > Let us know what happen and thanks Howard for report this. This is the
> kind
> > of help that is very useful for the project in general.
> >
> > regards,
> >
> > Leonardo Uribe
> >
> >
> > 2013/10/18 Leonardo Uribe <lu...@gmail.com>
> >
> > > Hi
> > >
> > > I was able to reproduce the problem. I have been testing this issue
> > > against jetty / weld, and this issue comes when using tomcat / owb
> > > configuration. It seems when the session is destroyed,
> > > CDIManagedBeanHandlerImpl try to get a reference of ViewScopeBeanHolder
> > and
> > > FlowScopeBeanHolder, but in that point of time the injection does not
> > work
> > > as you can expect and ViewScopeBeanHolder is recreated.
> > >
> > > This issue is becoming difficult ...
> > >
> > > regards,
> > >
> > > Leonardo Uribe
> > >
> > >
> > >
> > > 2013/10/18 Howard W. Smith, Jr. <sm...@gmail.com>
> > >
> > > On Thu, Oct 17, 2013 at 9:04 PM, Howard W. Smith, Jr. <
> > >> smithh032772@gmail.com> wrote:
> > >>
> > >> > OmniFaces CDI @ViewScoped[1] executes @PreDestroy on
> > >> session.invalidate()
> > >> > and that is what I like/expect, but MyFaces 2.2 CDI @ViewScoped
> > >> > implementation is not doing the same.
> > >>
> > >>
> > >> I am not trying to do any type of cross-forum posting. My goal is to
> > >> communicate/share my actual/expected test results.
> > >>
> > >> In production, I am using TomEE 1.6.0 (OWB) + MyFaces 2.1.12 +
> OmniFaces
> > >> 1.6(.1) CDI @ViewScoped, which invokes @PreDestroy on session
> > invalidation
> > >> 'and' expiration. Some minutes ago, I did a test against production
> app,
> > >> and just wanted to show you my 'actual test results' of production
> > (which)
> > >> = 'expected test results' of MyFaces 2.2 CDI @ViewScoped.
> > >>
> > >> In production, session timeout = 15 minutes, so I did a test against
> > >> production server, and did the 'same' test as Test 2 (session
> > expiration)
> > >> in my previous post that included my latest test and test results of
> > >> MyFaces 2.2 CDI @ViewScoped.
> > >>
> > >>
> > >> Test: login user, navigate to page which references CDI @ViewScoped
> > bean,
> > >> F5/refresh browser to generate another CDI @ViewScoped bean, and let
> > >> session expire via (15-minute) session timeout; @PreDestroy of
> > (OmniFaces)
> > >> CDI @ViewScoped bean executed. see below.
> > >>
> > >> Oct 18, 2013 11:20:29 AM jsf.users.pf_UsersController loginUser
> > >> INFO: administrator logged in at 10/18/2013 11:20 AM
> > >>
> > >> Oct 18, 2013 11:20:39 AM jsf.orders.OrderDocumentBean init
> > >> INFO: jsf.orders.OrderDocumentBean@650707eb
> > >>
> > >> Oct 18, 2013 11:20:42 AM jsf.orders.OrderDocumentBean init
> > >> INFO: jsf.orders.OrderDocumentBean@132f168a
> > >>
> > >> -- session expired --
> > >>
> > >> Oct 18, 2013 11:35:43 AM jsf.orders.OrderDocumentBean releaseResources
> > >> INFO: jsf.orders.OrderDocumentBean@132f168a
> > >>
> > >> Oct 18, 2013 11:35:43 AM jsf.orders.OrderDocumentBean releaseResources
> > >> INFO: jsf.orders.OrderDocumentBean@650707eb
> > >>
> > >> Oct 18, 2013 11:35:43 AM jsf.users.pf_UsersController sessionTimeout
> > >> INFO: administrator session ended at 10/18/2013 11:35 AM
> > >>
> > >
> > >
> >
>

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
Leonardo,

I see myfaces 2.2 api JAR was updated but not myfaces 2.2 impl JAR. Did you
want me to just download the following JAR and retest, or there is
another/later version of the JAR, which is yet to be built?

myfaces-api-2.2.0-20131018.201520-2509.jar<https://repository.apache.org/content/repositories/snapshots/org/apache/myfaces/core/myfaces-api/2.2.0-SNAPSHOT/myfaces-api-2.2.0-20131018.201520-2509.jar>


thanks,
Howard

On Fri, Oct 18, 2013 at 3:05 PM, Leonardo Uribe <lu...@gmail.com> wrote:

> Hi
>
> I have committed a mixed solution between @PreDestroy annotation and
> ManagedBeanDestroyerListener. The idea is the first one in destroy the
> beans wins and the second one is just ignored. I have tested it with both
> configurations, so I hope it will work in your application.
>
> Let us know what happen and thanks Howard for report this. This is the kind
> of help that is very useful for the project in general.
>
> regards,
>
> Leonardo Uribe
>
>
> 2013/10/18 Leonardo Uribe <lu...@gmail.com>
>
> > Hi
> >
> > I was able to reproduce the problem. I have been testing this issue
> > against jetty / weld, and this issue comes when using tomcat / owb
> > configuration. It seems when the session is destroyed,
> > CDIManagedBeanHandlerImpl try to get a reference of ViewScopeBeanHolder
> and
> > FlowScopeBeanHolder, but in that point of time the injection does not
> work
> > as you can expect and ViewScopeBeanHolder is recreated.
> >
> > This issue is becoming difficult ...
> >
> > regards,
> >
> > Leonardo Uribe
> >
> >
> >
> > 2013/10/18 Howard W. Smith, Jr. <sm...@gmail.com>
> >
> > On Thu, Oct 17, 2013 at 9:04 PM, Howard W. Smith, Jr. <
> >> smithh032772@gmail.com> wrote:
> >>
> >> > OmniFaces CDI @ViewScoped[1] executes @PreDestroy on
> >> session.invalidate()
> >> > and that is what I like/expect, but MyFaces 2.2 CDI @ViewScoped
> >> > implementation is not doing the same.
> >>
> >>
> >> I am not trying to do any type of cross-forum posting. My goal is to
> >> communicate/share my actual/expected test results.
> >>
> >> In production, I am using TomEE 1.6.0 (OWB) + MyFaces 2.1.12 + OmniFaces
> >> 1.6(.1) CDI @ViewScoped, which invokes @PreDestroy on session
> invalidation
> >> 'and' expiration. Some minutes ago, I did a test against production app,
> >> and just wanted to show you my 'actual test results' of production
> (which)
> >> = 'expected test results' of MyFaces 2.2 CDI @ViewScoped.
> >>
> >> In production, session timeout = 15 minutes, so I did a test against
> >> production server, and did the 'same' test as Test 2 (session
> expiration)
> >> in my previous post that included my latest test and test results of
> >> MyFaces 2.2 CDI @ViewScoped.
> >>
> >>
> >> Test: login user, navigate to page which references CDI @ViewScoped
> bean,
> >> F5/refresh browser to generate another CDI @ViewScoped bean, and let
> >> session expire via (15-minute) session timeout; @PreDestroy of
> (OmniFaces)
> >> CDI @ViewScoped bean executed. see below.
> >>
> >> Oct 18, 2013 11:20:29 AM jsf.users.pf_UsersController loginUser
> >> INFO: administrator logged in at 10/18/2013 11:20 AM
> >>
> >> Oct 18, 2013 11:20:39 AM jsf.orders.OrderDocumentBean init
> >> INFO: jsf.orders.OrderDocumentBean@650707eb
> >>
> >> Oct 18, 2013 11:20:42 AM jsf.orders.OrderDocumentBean init
> >> INFO: jsf.orders.OrderDocumentBean@132f168a
> >>
> >> -- session expired --
> >>
> >> Oct 18, 2013 11:35:43 AM jsf.orders.OrderDocumentBean releaseResources
> >> INFO: jsf.orders.OrderDocumentBean@132f168a
> >>
> >> Oct 18, 2013 11:35:43 AM jsf.orders.OrderDocumentBean releaseResources
> >> INFO: jsf.orders.OrderDocumentBean@650707eb
> >>
> >> Oct 18, 2013 11:35:43 AM jsf.users.pf_UsersController sessionTimeout
> >> INFO: administrator session ended at 10/18/2013 11:35 AM
> >>
> >
> >
>

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
Leonardo, that's great to hear and you're welcome. i'm a very happy MyFaces
user and definitely want to see MyFaces 2.2.x working as
RI/expected/intended/designed/spec'ified. :)

As before, I can wait for repository to be updated, can download, and test,
and can report, accordingly/afterwards.

thanks,
Howard



On Fri, Oct 18, 2013 at 3:05 PM, Leonardo Uribe <lu...@gmail.com> wrote:

> Hi
>
> I have committed a mixed solution between @PreDestroy annotation and
> ManagedBeanDestroyerListener. The idea is the first one in destroy the
> beans wins and the second one is just ignored. I have tested it with both
> configurations, so I hope it will work in your application.
>
> Let us know what happen and thanks Howard for report this. This is the kind
> of help that is very useful for the project in general.
>
> regards,
>
> Leonardo Uribe
>
>
> 2013/10/18 Leonardo Uribe <lu...@gmail.com>
>
> > Hi
> >
> > I was able to reproduce the problem. I have been testing this issue
> > against jetty / weld, and this issue comes when using tomcat / owb
> > configuration. It seems when the session is destroyed,
> > CDIManagedBeanHandlerImpl try to get a reference of ViewScopeBeanHolder
> and
> > FlowScopeBeanHolder, but in that point of time the injection does not
> work
> > as you can expect and ViewScopeBeanHolder is recreated.
> >
> > This issue is becoming difficult ...
> >
> > regards,
> >
> > Leonardo Uribe
> >
> >
> >
> > 2013/10/18 Howard W. Smith, Jr. <sm...@gmail.com>
> >
> > On Thu, Oct 17, 2013 at 9:04 PM, Howard W. Smith, Jr. <
> >> smithh032772@gmail.com> wrote:
> >>
> >> > OmniFaces CDI @ViewScoped[1] executes @PreDestroy on
> >> session.invalidate()
> >> > and that is what I like/expect, but MyFaces 2.2 CDI @ViewScoped
> >> > implementation is not doing the same.
> >>
> >>
> >> I am not trying to do any type of cross-forum posting. My goal is to
> >> communicate/share my actual/expected test results.
> >>
> >> In production, I am using TomEE 1.6.0 (OWB) + MyFaces 2.1.12 + OmniFaces
> >> 1.6(.1) CDI @ViewScoped, which invokes @PreDestroy on session
> invalidation
> >> 'and' expiration. Some minutes ago, I did a test against production app,
> >> and just wanted to show you my 'actual test results' of production
> (which)
> >> = 'expected test results' of MyFaces 2.2 CDI @ViewScoped.
> >>
> >> In production, session timeout = 15 minutes, so I did a test against
> >> production server, and did the 'same' test as Test 2 (session
> expiration)
> >> in my previous post that included my latest test and test results of
> >> MyFaces 2.2 CDI @ViewScoped.
> >>
> >>
> >> Test: login user, navigate to page which references CDI @ViewScoped
> bean,
> >> F5/refresh browser to generate another CDI @ViewScoped bean, and let
> >> session expire via (15-minute) session timeout; @PreDestroy of
> (OmniFaces)
> >> CDI @ViewScoped bean executed. see below.
> >>
> >> Oct 18, 2013 11:20:29 AM jsf.users.pf_UsersController loginUser
> >> INFO: administrator logged in at 10/18/2013 11:20 AM
> >>
> >> Oct 18, 2013 11:20:39 AM jsf.orders.OrderDocumentBean init
> >> INFO: jsf.orders.OrderDocumentBean@650707eb
> >>
> >> Oct 18, 2013 11:20:42 AM jsf.orders.OrderDocumentBean init
> >> INFO: jsf.orders.OrderDocumentBean@132f168a
> >>
> >> -- session expired --
> >>
> >> Oct 18, 2013 11:35:43 AM jsf.orders.OrderDocumentBean releaseResources
> >> INFO: jsf.orders.OrderDocumentBean@132f168a
> >>
> >> Oct 18, 2013 11:35:43 AM jsf.orders.OrderDocumentBean releaseResources
> >> INFO: jsf.orders.OrderDocumentBean@650707eb
> >>
> >> Oct 18, 2013 11:35:43 AM jsf.users.pf_UsersController sessionTimeout
> >> INFO: administrator session ended at 10/18/2013 11:35 AM
> >>
> >
> >
>

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

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

I have committed a mixed solution between @PreDestroy annotation and
ManagedBeanDestroyerListener. The idea is the first one in destroy the
beans wins and the second one is just ignored. I have tested it with both
configurations, so I hope it will work in your application.

Let us know what happen and thanks Howard for report this. This is the kind
of help that is very useful for the project in general.

regards,

Leonardo Uribe


2013/10/18 Leonardo Uribe <lu...@gmail.com>

> Hi
>
> I was able to reproduce the problem. I have been testing this issue
> against jetty / weld, and this issue comes when using tomcat / owb
> configuration. It seems when the session is destroyed,
> CDIManagedBeanHandlerImpl try to get a reference of ViewScopeBeanHolder and
> FlowScopeBeanHolder, but in that point of time the injection does not work
> as you can expect and ViewScopeBeanHolder is recreated.
>
> This issue is becoming difficult ...
>
> regards,
>
> Leonardo Uribe
>
>
>
> 2013/10/18 Howard W. Smith, Jr. <sm...@gmail.com>
>
> On Thu, Oct 17, 2013 at 9:04 PM, Howard W. Smith, Jr. <
>> smithh032772@gmail.com> wrote:
>>
>> > OmniFaces CDI @ViewScoped[1] executes @PreDestroy on
>> session.invalidate()
>> > and that is what I like/expect, but MyFaces 2.2 CDI @ViewScoped
>> > implementation is not doing the same.
>>
>>
>> I am not trying to do any type of cross-forum posting. My goal is to
>> communicate/share my actual/expected test results.
>>
>> In production, I am using TomEE 1.6.0 (OWB) + MyFaces 2.1.12 + OmniFaces
>> 1.6(.1) CDI @ViewScoped, which invokes @PreDestroy on session invalidation
>> 'and' expiration. Some minutes ago, I did a test against production app,
>> and just wanted to show you my 'actual test results' of production (which)
>> = 'expected test results' of MyFaces 2.2 CDI @ViewScoped.
>>
>> In production, session timeout = 15 minutes, so I did a test against
>> production server, and did the 'same' test as Test 2 (session expiration)
>> in my previous post that included my latest test and test results of
>> MyFaces 2.2 CDI @ViewScoped.
>>
>>
>> Test: login user, navigate to page which references CDI @ViewScoped bean,
>> F5/refresh browser to generate another CDI @ViewScoped bean, and let
>> session expire via (15-minute) session timeout; @PreDestroy of (OmniFaces)
>> CDI @ViewScoped bean executed. see below.
>>
>> Oct 18, 2013 11:20:29 AM jsf.users.pf_UsersController loginUser
>> INFO: administrator logged in at 10/18/2013 11:20 AM
>>
>> Oct 18, 2013 11:20:39 AM jsf.orders.OrderDocumentBean init
>> INFO: jsf.orders.OrderDocumentBean@650707eb
>>
>> Oct 18, 2013 11:20:42 AM jsf.orders.OrderDocumentBean init
>> INFO: jsf.orders.OrderDocumentBean@132f168a
>>
>> -- session expired --
>>
>> Oct 18, 2013 11:35:43 AM jsf.orders.OrderDocumentBean releaseResources
>> INFO: jsf.orders.OrderDocumentBean@132f168a
>>
>> Oct 18, 2013 11:35:43 AM jsf.orders.OrderDocumentBean releaseResources
>> INFO: jsf.orders.OrderDocumentBean@650707eb
>>
>> Oct 18, 2013 11:35:43 AM jsf.users.pf_UsersController sessionTimeout
>> INFO: administrator session ended at 10/18/2013 11:35 AM
>>
>
>

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

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

I was able to reproduce the problem. I have been testing this issue against
jetty / weld, and this issue comes when using tomcat / owb configuration.
It seems when the session is destroyed, CDIManagedBeanHandlerImpl try to
get a reference of ViewScopeBeanHolder and FlowScopeBeanHolder, but in that
point of time the injection does not work as you can expect and
ViewScopeBeanHolder is recreated.

This issue is becoming difficult ...

regards,

Leonardo Uribe



2013/10/18 Howard W. Smith, Jr. <sm...@gmail.com>

> On Thu, Oct 17, 2013 at 9:04 PM, Howard W. Smith, Jr. <
> smithh032772@gmail.com> wrote:
>
> > OmniFaces CDI @ViewScoped[1] executes @PreDestroy on session.invalidate()
> > and that is what I like/expect, but MyFaces 2.2 CDI @ViewScoped
> > implementation is not doing the same.
>
>
> I am not trying to do any type of cross-forum posting. My goal is to
> communicate/share my actual/expected test results.
>
> In production, I am using TomEE 1.6.0 (OWB) + MyFaces 2.1.12 + OmniFaces
> 1.6(.1) CDI @ViewScoped, which invokes @PreDestroy on session invalidation
> 'and' expiration. Some minutes ago, I did a test against production app,
> and just wanted to show you my 'actual test results' of production (which)
> = 'expected test results' of MyFaces 2.2 CDI @ViewScoped.
>
> In production, session timeout = 15 minutes, so I did a test against
> production server, and did the 'same' test as Test 2 (session expiration)
> in my previous post that included my latest test and test results of
> MyFaces 2.2 CDI @ViewScoped.
>
>
> Test: login user, navigate to page which references CDI @ViewScoped bean,
> F5/refresh browser to generate another CDI @ViewScoped bean, and let
> session expire via (15-minute) session timeout; @PreDestroy of (OmniFaces)
> CDI @ViewScoped bean executed. see below.
>
> Oct 18, 2013 11:20:29 AM jsf.users.pf_UsersController loginUser
> INFO: administrator logged in at 10/18/2013 11:20 AM
>
> Oct 18, 2013 11:20:39 AM jsf.orders.OrderDocumentBean init
> INFO: jsf.orders.OrderDocumentBean@650707eb
>
> Oct 18, 2013 11:20:42 AM jsf.orders.OrderDocumentBean init
> INFO: jsf.orders.OrderDocumentBean@132f168a
>
> -- session expired --
>
> Oct 18, 2013 11:35:43 AM jsf.orders.OrderDocumentBean releaseResources
> INFO: jsf.orders.OrderDocumentBean@132f168a
>
> Oct 18, 2013 11:35:43 AM jsf.orders.OrderDocumentBean releaseResources
> INFO: jsf.orders.OrderDocumentBean@650707eb
>
> Oct 18, 2013 11:35:43 AM jsf.users.pf_UsersController sessionTimeout
> INFO: administrator session ended at 10/18/2013 11:35 AM
>

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
On Thu, Oct 17, 2013 at 9:04 PM, Howard W. Smith, Jr. <
smithh032772@gmail.com> wrote:

> OmniFaces CDI @ViewScoped[1] executes @PreDestroy on session.invalidate()
> and that is what I like/expect, but MyFaces 2.2 CDI @ViewScoped
> implementation is not doing the same.


I am not trying to do any type of cross-forum posting. My goal is to
communicate/share my actual/expected test results.

In production, I am using TomEE 1.6.0 (OWB) + MyFaces 2.1.12 + OmniFaces
1.6(.1) CDI @ViewScoped, which invokes @PreDestroy on session invalidation
'and' expiration. Some minutes ago, I did a test against production app,
and just wanted to show you my 'actual test results' of production (which)
= 'expected test results' of MyFaces 2.2 CDI @ViewScoped.

In production, session timeout = 15 minutes, so I did a test against
production server, and did the 'same' test as Test 2 (session expiration)
in my previous post that included my latest test and test results of
MyFaces 2.2 CDI @ViewScoped.


Test: login user, navigate to page which references CDI @ViewScoped bean,
F5/refresh browser to generate another CDI @ViewScoped bean, and let
session expire via (15-minute) session timeout; @PreDestroy of (OmniFaces)
CDI @ViewScoped bean executed. see below.

Oct 18, 2013 11:20:29 AM jsf.users.pf_UsersController loginUser
INFO: administrator logged in at 10/18/2013 11:20 AM

Oct 18, 2013 11:20:39 AM jsf.orders.OrderDocumentBean init
INFO: jsf.orders.OrderDocumentBean@650707eb

Oct 18, 2013 11:20:42 AM jsf.orders.OrderDocumentBean init
INFO: jsf.orders.OrderDocumentBean@132f168a

-- session expired --

Oct 18, 2013 11:35:43 AM jsf.orders.OrderDocumentBean releaseResources
INFO: jsf.orders.OrderDocumentBean@132f168a

Oct 18, 2013 11:35:43 AM jsf.orders.OrderDocumentBean releaseResources
INFO: jsf.orders.OrderDocumentBean@650707eb

Oct 18, 2013 11:35:43 AM jsf.users.pf_UsersController sessionTimeout
INFO: administrator session ended at 10/18/2013 11:35 AM

Re: [MyFaces 2.2] invoke @PreDestroy on (CDI) ViewScoped beans upon session expiration

Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
On Thu, Oct 17, 2013 at 8:53 PM, Howard W. Smith, Jr. <
smithh032772@gmail.com> wrote:

> Clarification: my test included session.invalidate() instead of (actual)
> session expired (via/after session timeout).
>
> will provide test (config, steps and) results in my next response to this
> thread.
>

i tested my app with latest MyFaces 2.2.0 snapshot (2013-Oct-17) with TomEE
1.6.0 snapshot (2013-Oct-10; myfaces comitter said that myfaces 2.2.0
snapshots works with this version of tomee 1.6.0 snapshot),

removed myfaces 2.1.12 JARs from tomee/lib, and dropped myfaces 2.2.0 JARs
in tomee/lib

modified one of my beans, replaced OmniFaces CDI @ViewScoped with MyFaces
2.2.0 CDI @ViewScoped (javax.faces.view.ViewScoped)

generated WAR, deployed WAR to tomee/webapps, started tomee, and started
test(ing)


- navigated to page which references (myfaces 2.2.0 CDI @ViewScoped);
@PostConstruct executed

Oct 17, 2013 7:33:56 PM jsf.orders.OrderDocumentBean init
INFO: jsf.orders.OrderDocumentBean@3273c362

- navigated away from that page (action="index.xhtml", non-null outcome);
@PreDestroy executed

Oct 17, 2013 7:34:30 PM jsf.orders.OrderDocumentBean releaseResources
INFO: jsf.orders.OrderDocumentBean@3273c362

- navigated to page which references (myfaces 2.2.0 CDI @ViewScoped)

Oct 17, 2013 7:35:22 PM jsf.orders.OrderDocumentBean init
INFO: jsf.orders.OrderDocumentBean@214e2561

- navigated away from that page (action = null outcome), bean not destroyed
(of course)
- navigated to another page (action="index.xhtml", non-null outcome), bean
destroyed

Oct 17, 2013 7:35:35 PM jsf.orders.OrderDocumentBean releaseResources
INFO: jsf.orders.OrderDocumentBean@214e2561

- navigated to page which references (myfaces 2.2.0 CDI @ViewScoped)

Oct 17, 2013 7:35:50 PM jsf.orders.OrderDocumentBean init
INFO: jsf.orders.OrderDocumentBean@28a78a2c

- pressed F5/refresh in Google Chrome, new bean created and page does not
render data anymore :(

Oct 17, 2013 7:36:11 PM jsf.orders.OrderDocumentBean init
INFO: jsf.orders.OrderDocumentBean@7af07081

- logged out user (session.invalidate() is executed, @PreDestroy not
executed to show that the beans were destroyed)

Oct 17, 2013 7:36:39 PM jsf.users.pf_UsersController logout
INFO: administrator logged out at 10/17/2013 07:36 PM

- but checked jvisualvm (heap dump) and 0/zero/no instances of CDI
@ViewScoped bean exist

OmniFaces CDI @ViewScoped[1] executes @PreDestroy on session.invalidate()
and that is what I like/expect, but MyFaces 2.2 CDI @ViewScoped
implementation is not doing the same.

so, is omnifaces (and mojarra 2.2) CDI @ViewScoped 'spec-compliant', or is
this an added feature of OmniFaces, to execute @PreDestroy before CDI
@ViewScoped bean is destroyed on session.invalidate()?


[1] https://code.google.com/p/omnifaces/issues/detail?id=201