log.info("ActiveMQ Message Broker (" + getBrokerName()+", "+brokerId+") is shutting down");
BrokerRegistry.getInstance().unbind(getBrokerName());
removeShutdownHook();
ServiceStopper stopper = new ServiceStopper();
if (services != null) {
for (int i = 0; i < services.length; i++) {
Service service = services[i];
stopper.stop(service);
}
}
stopAllConnectors(stopper);
//remove any VMTransports connected
VMTransportFactory.stopped(getBrokerName());
stopper.stop(persistenceAdapter);
if (broker != null) {
stopper.stop(broker);
}
if(tempDataStore!=null){
tempDataStore.close();
}
if (isUseJmx()) {
MBeanServer mbeanServer = getManagementContext().getMBeanServer();
if (mbeanServer != null) {
for (Iterator iter = registeredMBeanNames.iterator(); iter.hasNext();) {
ObjectName name = (ObjectName) iter.next();
try {
mbeanServer.unregisterMBean(name);
}
catch (Exception e) {
stopper.onException(mbeanServer, e);
}
}
}
stopper.stop(getManagementContext());
}
log.info("ActiveMQ JMS Message Broker (" + getBrokerName()+", "+brokerId+") stopped");
stopper.throwFirstException();
}