Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2018

Weld-SE's shutdown hook fails to dispose of CDI managed objects

    XMLWordPrintable

Details

    Description

      @PreDestroy is not called for CDI managed objects when the JVM calls the Weld SE ShutdownHook. Issue WELD-1579 fixed this during 2.1 development and my limited testing shows that it's still working in the latest 2.2 release. As noted, it doesn't work at all in 2.3.0.CR1 or 3.0.0.Alpha11.

      During my testing I discovered a second problem with container shutdown and I suspect this problem will also exist when calling shutdown() programatically. Objects that are dynamically instantiated by the container don't seem to be properly disposed. Objects created by the following code will not have their @PostConstruct methods called on shutdown:

          OtherThread otherThread = CDI.current().select(OtherThread.class).get();
      

      for Versions up through 2.2.15, object created by the following code will have their @PostConstruct methods called on shutdown:

          @Inject
          OtherThread otherThread_;
      

      Attachments

        Activity

          People

            mkouba@redhat.com Martin Kouba
            smoyer64 Steve Moyer (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: