Author: bvahdat
Date: Fri Oct 5 12:25:46 2012
New Revision: 1394479
URL: http://svn.apache.org/viewvc?rev=1394479&view=rev
Log:
CAMEL-5686: While stopping the QuickfixjEngine should unregister the MBean being registered
for the Initiator at startup.
Modified:
camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java
camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java
Modified: camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java?rev=1394479&r1=1394478&r2=1394479&view=diff
==============================================================================
--- camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java
(original)
+++ camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java
Fri Oct 5 12:25:46 2012
@@ -25,6 +25,7 @@ import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.management.JMException;
+import javax.management.ObjectName;
import org.apache.camel.support.ServiceSupport;
import org.apache.camel.util.ObjectHelper;
@@ -95,6 +96,7 @@ public class QuickfixjEngine extends Ser
private final MessageCorrelator messageCorrelator = new MessageCorrelator();
private List<QuickfixjEventListener> eventListeners = new CopyOnWriteArrayList<QuickfixjEventListener>();
private final String uri;
+ private ObjectName connectorObjectName;
public enum ThreadModel {
ThreadPerConnector, ThreadPerSession;
@@ -226,7 +228,7 @@ public class QuickfixjEngine extends Ser
if (initiator != null) {
initiator.start();
if (jmxExporter != null) {
- jmxExporter.register(initiator);
+ connectorObjectName = jmxExporter.register(initiator);
}
}
}
@@ -238,6 +240,10 @@ public class QuickfixjEngine extends Ser
}
if (initiator != null) {
initiator.stop();
+
+ if (jmxExporter != null && connectorObjectName != null) {
+ jmxExporter.getMBeanServer().unregisterMBean(connectorObjectName);
+ }
}
}
Modified: camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java?rev=1394479&r1=1394478&r2=1394479&view=diff
==============================================================================
--- camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java
(original)
+++ camel/trunk/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java
Fri Oct 5 12:25:46 2012
@@ -383,7 +383,6 @@ public class QuickfixjEngineTest {
}
@Test
- @Ignore("The unit test works but we have a collision with the enableJmxForInitiator one")
public void enableJmxForAcceptor() throws Exception {
settings.setBool(QuickfixjEngine.SETTING_USE_JMX, true);
settings.setString(sessionID, SessionFactory.SETTING_CONNECTION_TYPE, SessionFactory.ACCEPTOR_CONNECTION_TYPE);
|