On Thu, Oct 17, 2013 at 8:53 PM, Howard W. Smith, Jr. <
smithh032...@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

Reply via email to