CDI+Push+Wildfly Detach

Hello,

I am currently running in the follwoing issue:

I am writing an application, which is updated via push from a worker thread. And I need to cleanup the worker
a) on detach
b) when the application context is destroyed (e.g., during redeployment during development)

  • Vaadin 7.3.2
  • Vaadin-cdi beta2
  • Wildfly 8.1.0.Final

As long as I do not activate Push, deach() as a Detachment Listener is called as expected.
When I activate Push, detach is never triggrered.

I also tested to add a @WebListener implementing ServletContextListener.
The interesting thing happening here is, that as long as I just deploy the application, and do not open the UI in a browser, instantiating an UI, the contextDestroyed(ServletContextEvent sce) is called as expected when I undeploy/redeploy. However, as soon as I instantiate an UI by opening it in the browser, this stops working, and just as the detach() method, the contextdestroyed method is never called.

Has anybody encountered this behaviour and has a suggestion how to resolve this?

Thank you.

Best regards,
Dominic

Just to clarify a bit:

  • page reload triggers detach

  • session timeout triggers detach

  • stopping the application/redeployment does not trigger detach, and it does not trigger the contextDestroyed Method of the WebListener when a CDI UI with Push was loaded.

Result: Uncontrolled Threads/Memory leaks on redeployment.

Also tested the CDI 1.0-SNAPSHOT. Did get the same results. (I noticed the addition of the shiro tests. Very nice, because i also noticed, that shiro now works very well with CDI. Excellent. Thanks!)
Thanks.

Dominic