9 Replies Latest reply on Sep 25, 2012 11:22 AM by zenzei2k

    Destroy-method not getting called when JBossAS is shutdown

    saltnlight5

      Hi there,

       

      I have successfully deployed the snowdrop into JBossAS 7.1.1.FINAL, and I can deploy a simple spring application with jboss-spring.xml as this:

       

          <bean id="helloService" class="deng.HelloService" init-method="start" destroy-method="stop">
          </bean>
      

       

      My HelloService is a simple one like this:

       

      package deng;
      import org.slf4j.*;
      import java.util.concurrent.atomic.*;
      public class HelloService {
                private static Logger logger = LoggerFactory.getLogger(HelloService.class);
                private AtomicBoolean started = new AtomicBoolean(false);
                public boolean isStarted() { return started.get(); }
                public void start() { started.set(true); logger.info("started."); }
                public void stop() { started.set(false); logger.info("stopped."); }
      }
      

       

      When I package this into jboss-spring-app-1.0.0-SNAPSHOT.jar, the server deployed it fine. However when I shutdwon the server with CTRL+C (or with CLI), the stop() is never called. Is this a bug?

       

      Thanks,

      Zemian Deng

        • 1. Re: Destroy-method not getting called when JBossAS is shutdown
          saltnlight5

          FYI, here is my log output. Notice at the end that I don't see my "stopped" message.

          22:20:23,676 INFO  [org.jboss.modules] JBoss Modules version 1.1.1.GA

          22:20:23,969 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA

          22:20:24,006 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting

          22:20:24,650 INFO  [org.xnio] XNIO Version 3.0.3.GA

          22:20:24,650 INFO  [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)

          22:20:24,661 INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA

          22:20:24,669 INFO  [org.jboss.remoting] JBoss Remoting version 3.2.3.GA

          22:20:24,678 INFO  [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers

          22:20:24,679 INFO  [org.jboss.snowdrop] (ServerService Thread Pool -- 27) Activating Spring Deployer subsystem

          22:20:24,680 INFO  [org.jboss.as.configadmin] (ServerService Thread Pool -- 28) JBAS016200: Activating ConfigAdmin Subsystem

          22:20:24,701 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 33) JBAS010280: Activating Infinispan subsystem.

          22:20:24,712 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 50) JBAS015537: Activating WebServices Extension

          22:20:24,717 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 46) JBAS013101: Activating Security Subsystem

          22:20:24,718 INFO  [org.jboss.as.osgi] (ServerService Thread Pool -- 41) JBAS011940: Activating OSGi Subsystem

          22:20:24,720 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 40) JBAS011800: Activating Naming Subsystem

          22:20:24,726 INFO  [org.jboss.as.security] (MSC service thread 1-5) JBAS013100: Current PicketBox version=4.0.7.Final

          22:20:24,764 INFO  [org.jboss.as.connector] (MSC service thread 1-1) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)

          22:20:24,775 INFO  [org.jboss.as.naming] (MSC service thread 1-3) JBAS011802: Starting Naming Service

          22:20:24,798 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-3) JBAS015400: Bound mail session [java:jboss/mail/Default]

          22:20:24,818 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-1) JBoss Web Services - Stack CXF Server 4.0.2.GA

          22:20:24,838 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 29) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)

          22:20:25,021 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-8) Starting Coyote HTTP/1.1 on http--127.0.0.1-8080

          22:20:25,213 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-6) JBAS015012: Started FileSystemDeploymentService for directory /Users/zemian/apps/jboss/standalone/deployments

          22:20:25,219 INFO  [org.jboss.as.remoting] (MSC service thread 1-1) JBAS017100: Listening on /127.0.0.1:9999

          22:20:25,220 INFO  [org.jboss.as.remoting] (MSC service thread 1-8) JBAS017100: Listening on /127.0.0.1:4447

          22:20:25,329 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]

          22:20:25,341 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990

          22:20:25,342 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 1873ms - Started 133 of 209 services (74 services are passive or on-demand)

          22:20:25,348 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876: Starting deployment of "jboss-spring-app-1.0.0-SNAPSHOT.jar"

          22:20:25,547 INFO  [org.jboss.spring.factory.NamedXmlApplicationContext] (MSC service thread 1-2) Refreshing org.jboss.spring.factory.NamedXmlApplicationContext@28800269: startup date [Sun Jul 29 22:20:25 EDT 2012]; root of context hierarchy

          22:20:25,580 INFO  [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (MSC service thread 1-2) Loading XML bean definitions from "/content/jboss-spring-app-1.0.0-SNAPSHOT.jar/META-INF/jboss-spring.xml"

          22:20:26,368 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (MSC service thread 1-2) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1f1eaa09: defining beans [helloService]; root of factory hierarchy

          22:20:26,381 INFO  [deng.HelloService] (MSC service thread 1-2) started.

          22:20:26,432 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "jboss-spring-app-1.0.0-SNAPSHOT.jar"

           

           

          ^C22:20:30,647 INFO  [org.jboss.as.osgi] (MSC service thread 1-7) JBAS011942: Stopping OSGi Framework

          22:20:30,652 INFO  [org.jboss.as.logging] JBAS011503: Restored bootstrap log handlers

          22:20:30,654 INFO  [com.arjuna.ats.jbossatx] ARJUNA032018: Destroying TransactionManagerService

          22:20:30,655 INFO  [com.arjuna.ats.jbossatx] ARJUNA032014: Stopping transaction recovery manager

          22:20:30,658 INFO  [org.apache.catalina.core.StandardContext] Container org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/] has not been started

          22:20:30,658 INFO  [org.apache.coyote.http11.Http11Protocol] Pausing Coyote HTTP/1.1 on http--127.0.0.1-8080

          22:20:30,659 INFO  [org.apache.coyote.http11.Http11Protocol] Stopping Coyote HTTP/1.1 on http--127.0.0.1-8080

          22:20:30,661 INFO  [org.jboss.as.server.deployment] JBAS015877: Stopped deployment jboss-spring-app-1.0.0-SNAPSHOT.jar in 18ms

          22:20:30,669 INFO  [org.jboss.as] JBAS015950: JBoss AS 7.1.1.Final "Brontes" stopped in 24ms

          • 2. Re: Destroy-method not getting called when JBossAS is shutdown
            marius.bogoevici

            Hi Zemian,

             

            Yes it is. Thanks for using Snowdrop and for your feedback!

             

            Added https://issues.jboss.org/browse/SNOWDROP-57.

             

            Cheers,

            Marius

            • 3. Re: Destroy-method not getting called when JBossAS is shutdown
              zenzei2k

              Hi Marius! I'm having the same problem.

               

              Is there any chance to have this fix in a new version?

               

              Regards and thanks for your help!

              • 4. Re: Destroy-method not getting called when JBossAS is shutdown
                marius.bogoevici

                Yes, it is going to be fixed there.

                • 5. Re: Destroy-method not getting called when JBossAS is shutdown
                  zenzei2k

                  Hi Marius! Is there any estimated time for the new version?

                   

                  Thanks for your reponse!

                  • 6. Re: Destroy-method not getting called when JBossAS is shutdown
                    marius.bogoevici

                    Early next week (i.e. Monday-Tuesday at latest).

                    • 7. Re: Destroy-method not getting called when JBossAS is shutdown
                      zenzei2k

                      Wow, that would be really quick!

                      Thanks again!!!

                      • 8. Re: Destroy-method not getting called when JBossAS is shutdown
                        marius.bogoevici

                        Actually, thanks to Zemian's contribution. This has beed due to Zemian's contribution. We have slowed things down a bit during summer months with vacations and other engagements, but we have quite serious plans for the next couple releases.

                        • 9. Re: Destroy-method not getting called when JBossAS is shutdown
                          zenzei2k

                          Thanks Marius! I already download and package it with maven, and is working great.