camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1379322 - in /camel/branches/camel-2.10.x: ./ components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java
Date Fri, 31 Aug 2012 07:04:33 GMT
Author: davsclaus
Date: Fri Aug 31 07:04:33 2012
New Revision: 1379322

URL: http://svn.apache.org/viewvc?rev=1379322&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.10.x/   (props changed)
    camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java

Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1379320

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/QuickfixjComponent.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java?rev=1379322&r1=1379321&r2=1379322&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java
(original)
+++ camel/branches/camel-2.10.x/components/camel-quickfix/src/main/java/org/apache/camel/component/quickfixj/QuickfixjComponent.java
Fri Aug 31 07:04:33 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();



Mime
View raw message