Author: davsclaus
Date: Fri Aug 31 07:02:45 2012
New Revision: 1379320
URL: http://svn.apache.org/viewvc?rev=1379320&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/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java
Modified:
camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java?rev=1379320&r1=1379319&r2=1379320&view=diff
==============================================================================
---
camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java
(original)
+++
camel/trunk/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java
Fri Aug 31 07:02:45 2012
@@ -19,6 +19,7 @@ package org.apache.camel.component.quick
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;
@@ -62,7 +63,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);
}
}
@@ -93,6 +97,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();