}
@Override
protected synchronized void addShutdownHook() {
ArrayList<MBeanServer> al = MBeanServerFactory.findMBeanServer(null);
ShutdownHookBehavior shutdownHookBehavior = globalConfiguration.shutdown().hookBehavior();
boolean registerShutdownHook = (shutdownHookBehavior == ShutdownHookBehavior.DEFAULT && al.isEmpty())
|| shutdownHookBehavior == ShutdownHookBehavior.REGISTER;
if (registerShutdownHook) {
log.tracef("Registering a shutdown hook. Configured behavior = %s", shutdownHookBehavior);