2 Replies Latest reply on Sep 2, 2010 7:37 AM by cjalmeida

    PreDestroy on Extension class

    cjalmeida

      Seems like in Jboss 6.0.0.M4 a method annotated @PreDestroy in a Extension class (CDI portable extension) does not get called when undeploying/redeploying when packaged into an EAR.


      Is that the correct behavior?

        • 1. Re: PreDestroy on Extension class
          swd847

          You are better off observing BeforeShutdown instead:


          void beforeShutdown(@Observes BeforeShutdown event, BeanManager manager) { ... }
          
          



          I don't that PreDestory is supposed to work on extensions, as they are not beans.


          For each service provider, the container must provide a bean of scope @ApplicationScoped and qualifier @Default, sup-
          porting injection of a reference to the service provider instance.
          
          



          So the extension itself is not a bean, but rather for every extension a bean is created that allows you access to it.

          • 2. Re: PreDestroy on Extension class
            cjalmeida

            Fair enough. The seam-scheduling module in sandbox contains such error - it tries to use PreDestroy to shutdown Quartz.