Author: bvahdat Date: Tue Nov 6 06:29:25 2012 New Revision: 1406054 URL: http://svn.apache.org/viewvc?rev=1406054&view=rev Log: Merged revisions 1405932 via svnmerge from https://svn.apache.org/repos/asf/camel/trunk
........ r1405932 | bvahdat | 2012-11-05 21:09:25 +0100 (Mo, 05 Nov 2012) | 1 line CAMEL-5751: While stopping the QuickfixjEngine unregister the Connector MBean in the same way we do for the Initiator. Thanks to Christoph John providing this hint at http://www.quickfixj.org/jira/browse/QFJ-713. Also removed skipping the assert by QuickfixjEngineTest to see if this fixes the failing assert issue we're facing under JDK 7. ........ Modified: camel/branches/camel-2.10.x/ (props changed) camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java Propchange: camel/branches/camel-2.10.x/ ------------------------------------------------------------------------------ Merged /camel/trunk:r1405932 Propchange: camel/branches/camel-2.10.x/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java?rev=1406054&r1=1406053&r2=1406054&view=diff ============================================================================== --- camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java (original) +++ camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjEngine.java Tue Nov 6 06:29:25 2012 @@ -97,7 +97,8 @@ 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; + private ObjectName acceptorObjectName; + private ObjectName initiatorObjectName; public enum ThreadModel { ThreadPerConnector, ThreadPerSession; @@ -196,13 +197,13 @@ public class QuickfixjEngine extends Ser if (acceptor != null) { acceptor.start(); if (jmxExporter != null) { - jmxExporter.register(acceptor); + acceptorObjectName = jmxExporter.register(acceptor); } } if (initiator != null) { initiator.start(); if (jmxExporter != null) { - connectorObjectName = jmxExporter.register(initiator); + initiatorObjectName = jmxExporter.register(initiator); } } } @@ -211,12 +212,16 @@ public class QuickfixjEngine extends Ser protected void doStop() throws Exception { if (acceptor != null) { acceptor.stop(); + + if (jmxExporter != null && acceptorObjectName != null) { + jmxExporter.getMBeanServer().unregisterMBean(acceptorObjectName); + } } if (initiator != null) { initiator.stop(); - if (jmxExporter != null && connectorObjectName != null) { - jmxExporter.getMBeanServer().unregisterMBean(connectorObjectName); + if (jmxExporter != null && initiatorObjectName != null) { + jmxExporter.getMBeanServer().unregisterMBean(initiatorObjectName); } } } Modified: camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java?rev=1406054&r1=1406053&r2=1406054&view=diff ============================================================================== --- camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java (original) +++ camel/branches/camel-2.10.x/components/camel-quickfix/src/test/java/org/apache/camel/component/quickfixj/QuickfixjEngineTest.java Tue Nov 6 06:29:25 2012 @@ -588,14 +588,9 @@ public class QuickfixjEngineTest extends assertThat(quickfixjEngine.getLogFactory(), instanceOf(ScreenLogFactory.class)); assertThat(quickfixjEngine.getMessageFactory(), instanceOf(DefaultMessageFactory.class)); - if (isJava17()) { - // TODO: just from time to time the assert below fails on JDK 7 - return; - } - MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); - Set<ObjectName> names = mbeanServer.queryNames(new ObjectName("org.quickfixj:type=Connector,role=Acceptor,*"), null); - assertTrue("QFJ mbean should not have been registered", names.isEmpty()); + Set<ObjectName> names = mbeanServer.queryNames(new ObjectName("org.quickfixj:*"), null); + assertTrue("QFJ Connector/Initiator mbeans should not have been registered", names.isEmpty()); } private void writeSettings() throws IOException {