BarrierController Service and Dependent Service
jiwils Jan 12, 2006 1:27 PMI am using JBoss 4.0.2 with the BarrierController service in order to have some custom MBeans depend upon the starting of the Tomcat connectors. Upon startup, everything works just as expected, but upon shutdown of the application server, the "stop" method of my custom MBeans is never called.
To verify that my MBean is working correctly, I removed the dependency on the BarrierController service (the MBean it dynamically creates), and all works as expected including the stop method.
I've added my BarrierController XML and a simple Test MBean code below (in case I am doing something crazy), but could I have happened upon a bug? In the Test MBean code below, the "Stopping..." log message is never printed when the dependency to the BarrierController is added.
<server> <mbean code="org.jboss.system.BarrierController" name="jboss:service=BarrierController"> <attribute name="BarrierEnabledOnStartup">false</attribute> <attribute name="DynamicSubscriptions">true</attribute> <attribute name="BarrierObjectName"> com.acxiom.grid.jboss.services:name=TomcatConnectors,type=Barrier </attribute> <attribute name="StartBarrierHandback">start</attribute> <attribute name="StopBarrierHandback">stop</attribute> <attribute name="SubscriptionList"> <subscription-list> <mbean name="jboss.web:service=WebServer" handback="start"> <filter factory="NotificationFilterSupportFactory"> <enable type="jboss.tomcat.connectors.started"/> </filter> </mbean> <mbean name="jboss.system:type=Server" handback="stop"> <filter factory="NotificationFilterSupportFactory"> <enable type="org.jboss.system.server.stopped"/> </filter> </mbean> </subscription-list> </attribute> </mbean> </server>
package com.acxiom.grid.jboss.services.test; public interface TestMBean { void start(); void stop(); }
package com.acxiom.grid.jboss.services.test; import org.apache.log4j.Logger; public class Test implements TestMBean { Logger logger; public Test() { logger = Logger.getLogger(getClass()); } public void start() { logger.info("Starting..."); } public void stop() { logger.info("Stopping..."); } }