JBoss Community

Destroy-method not getting called when JBossAS is shutdown

created by Zemian Deng in Snowdrop - View the full discussion

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 my.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

Reply to this message by going to Community

Start a new discussion in Snowdrop at Community