Index: src/main/java/org/ow2/petals/component/framework/AbstractComponent.java =================================================================== --- src/main/java/org/ow2/petals/component/framework/AbstractComponent.java (revision 31569) +++ src/main/java/org/ow2/petals/component/framework/AbstractComponent.java (working copy) @@ -416,8 +416,10 @@ // call. this.processorManager = new JBIProcessorManager(this, this.runtimeConfigurationNotifier, this.logger); + this.processorManager.init(); this.acceptorManager = new JBIAcceptorManager(this, this.processorManager, this.runtimeConfigurationNotifier, this.logger); + this.acceptorManager.init(); this.asyncManager = new AsyncMessageManager(this.logger, this.processorManager); this.logger.info("Component initialized"); } @@ -475,6 +477,8 @@ this.logger.fine("Calling specific shut down..."); this.doShutdown(); this.logger.fine("Specific shut down done."); + this.processorManager.shutdown(); + this.acceptorManager.shutdown(); } finally { // remove unnecessary resources this.nativeWsdl = null; Index: src/main/java/org/ow2/petals/component/framework/process/JBIAcceptorManager.java =================================================================== --- src/main/java/org/ow2/petals/component/framework/process/JBIAcceptorManager.java (revision 31569) +++ src/main/java/org/ow2/petals/component/framework/process/JBIAcceptorManager.java (working copy) @@ -32,6 +32,7 @@ import javax.jbi.JBIException; import javax.jbi.messaging.MessageExchange; import javax.management.AttributeChangeNotification; +import javax.management.ListenerNotFoundException; import javax.management.Notification; import javax.management.NotificationListener; @@ -59,6 +60,10 @@ protected final AbstractComponent component; + private final RuntimeConfigurationNotifier runtimeConfiguration; + + private final RuntimeConfigurationListener runtimeConfigurationListener = new RuntimeConfigurationListener(); + /** * The Acceptor factory used to create new Acceptors * @@ -146,11 +151,21 @@ this.component = component; this.jbiProcessorManager = jbiProcessorManager; this.logger = log; - - // set the listener on the Runtime Configuration Notifier - runtimeConfiguration - .addNotificationListener(new RuntimeConfigurationListener(), null, null); + this.runtimeConfiguration = runtimeConfiguration; } + + public void init() throws JBIException { + this.runtimeConfiguration.addNotificationListener(this.runtimeConfigurationListener, null, + null); + } + + public void shutdown() throws JBIException { + try { + this.runtimeConfiguration.removeNotificationListener(this.runtimeConfigurationListener, null, null); + } catch (final ListenerNotFoundException e) { + throw new JBIException("Error unregistering the runtime configuration listener", e); + } + } /** * Initialize and start threads which listen to {@link MessageExchange}s Index: src/main/java/org/ow2/petals/component/framework/process/JBIProcessorManager.java =================================================================== --- src/main/java/org/ow2/petals/component/framework/process/JBIProcessorManager.java (revision 31569) +++ src/main/java/org/ow2/petals/component/framework/process/JBIProcessorManager.java (working copy) @@ -32,6 +32,7 @@ import javax.jbi.JBIException; import javax.management.AttributeChangeNotification; +import javax.management.ListenerNotFoundException; import javax.management.Notification; import javax.management.NotificationListener; @@ -65,6 +66,8 @@ protected AbstractComponent component; private final RuntimeConfigurationNotifier runtimeConfiguration; + + private final RuntimeConfigurationListener runtimeConfigurationListener = new RuntimeConfigurationListener(); protected Logger logger; @@ -256,9 +259,21 @@ this.runtimeConfiguration = runtimeConfiguration; this.logger = logger; - this.runtimeConfiguration.addNotificationListener(new RuntimeConfigurationListener(), null, + + } + + public void init() throws JBIException { + this.runtimeConfiguration.addNotificationListener(this.runtimeConfigurationListener, null, null); } + + public void shutdown() throws JBIException { + try { + this.runtimeConfiguration.removeNotificationListener(this.runtimeConfigurationListener, null, null); + } catch (final ListenerNotFoundException e) { + throw new JBIException("Error unregistering the runtime configuration listener", e); + } + } /** * Start the Processor Thread Pool.