You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2012/08/31 09:07:20 UTC
svn commit: r1379323 - in /camel/branches/camel-2.9.x: ./
components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java
Author: davsclaus
Date: Fri Aug 31 07:07:20 2012
New Revision: 1379323
URL: http://svn.apache.org/viewvc?rev=1379323&view=rev
Log:
CAMEL-5480: Quickfix engines is deferred to be started after CamelContext has been fully started. To avoid any side effects with engines firing too fast.
Modified:
camel/branches/camel-2.9.x/ (props changed)
camel/branches/camel-2.9.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1379320
Merged /camel/branches/camel-2.10.x:r1379322
Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.9.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java?rev=1379323&r1=1379322&r2=1379323&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java (original)
+++ camel/branches/camel-2.9.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java Fri Aug 31 07:07:20 2012
@@ -21,6 +21,7 @@ import java.net.URISyntaxException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
@@ -65,7 +66,10 @@ public class QuickfixjComponent extends
engine = new QuickfixjEngine(uri, remaining, forcedShutdown, messageStoreFactory, logFactory, messageFactory);
}
engines.put(remaining, engine);
- if (isStarted()) {
+
+ // only start engine if CamelContext is already started, otherwise the engines gets started
+ // automatic later when CamelContext has been started using the StartupListener
+ if (getCamelContext().getStatus().isStarted()) {
startQuickfixjEngine(engine);
}
}
@@ -96,6 +100,14 @@ public class QuickfixjComponent extends
super.doStop();
}
+ @Override
+ protected void doShutdown() throws Exception {
+ // cleanup when shutting down
+ engines.clear();
+ endpoints.clear();
+ super.doShutdown();
+ }
+
private void startQuickfixjEngine(QuickfixjEngine engine) throws Exception {
LOG.info("Starting QuickFIX/J engine: {}", engine.getUri());
engine.start();