Author: davsclaus
Date: Sat Nov  5 11:32:05 2011
New Revision: 1197934

URL: http://svn.apache.org/viewvc?rev=1197934&view=rev
Log:
CAMEL-4619: Fixed wrong timeout value used in logs during graceful shutdown 
when using a non default timeout value

Modified:
    camel/branches/camel-2.8.x/   (props changed)
    
camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Nov  5 11:32:05 2011
@@ -1 +1 @@
-/camel/trunk:1186106,1186625,1186772,1187221,1187485,1187882,1187893,1188070-1188085,1188642,1188674,1188879,1188881,1189139,1189600,1189681,1189693,1189737,1190212-1190213,1190246,1190303,1195317,1195616,1196210,1197450
+/camel/trunk:1186106,1186625,1186772,1187221,1187485,1187882,1187893,1188070-1188085,1188642,1188674,1188879,1188881,1189139,1189600,1189681,1189693,1189737,1190212-1190213,1190246,1190303,1195317,1195616,1196210,1197450,1197933

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: 
camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java?rev=1197934&r1=1197933&r2=1197934&view=diff
==============================================================================
--- 
camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java
 (original)
+++ 
camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java
 Sat Nov  5 11:32:05 2011
@@ -123,7 +123,7 @@ public class DefaultShutdownStrategy ext
         }
 
         // use another thread to perform the shutdowns so we can support 
timeout
-        Future future = getExecutorService().submit(new ShutdownTask(context, 
routesOrdered, suspendOnly, abortAfterTimeout));
+        Future future = getExecutorService().submit(new ShutdownTask(context, 
routesOrdered, timeout, timeUnit, suspendOnly, abortAfterTimeout));
         try {
             if (timeout > 0) {
                 future.get(timeout, timeUnit);
@@ -238,7 +238,7 @@ public class DefaultShutdownStrategy ext
      *
      * @param consumer the consumer to shutdown
      */
-    protected void shutdownNow(Consumer consumer) {
+    protected static void shutdownNow(Consumer consumer) {
         LOG.trace("Shutting down: {}", consumer);
 
         // allow us to do custom work before delegating to service helper
@@ -258,7 +258,7 @@ public class DefaultShutdownStrategy ext
      *
      * @param consumer the consumer to suspend
      */
-    protected void suspendNow(Consumer consumer) {
+    protected static void suspendNow(Consumer consumer) {
         LOG.trace("Suspending: {}", consumer);
 
         // allow us to do custom work before delegating to service helper
@@ -299,7 +299,7 @@ public class DefaultShutdownStrategy ext
         }
     }
 
-    class ShutdownDeferredConsumer {
+    static class ShutdownDeferredConsumer {
         private final Route route;
         private final Consumer consumer;
 
@@ -320,18 +320,23 @@ public class DefaultShutdownStrategy ext
     /**
      * Shutdown task which shutdown all the routes in a graceful manner.
      */
-    class ShutdownTask implements Runnable {
+    static class ShutdownTask implements Runnable {
 
         private final CamelContext context;
         private final List<RouteStartupOrder> routes;
         private final boolean suspendOnly;
         private final boolean abortAfterTimeout;
+        private final long timeout;
+        private final TimeUnit timeUnit;
 
-        public ShutdownTask(CamelContext context, List<RouteStartupOrder> 
routes, boolean suspendOnly, boolean abortAfterTimeout) {
+        public ShutdownTask(CamelContext context, List<RouteStartupOrder> 
routes, long timeout, TimeUnit timeUnit,
+                            boolean suspendOnly, boolean abortAfterTimeout) {
             this.context = context;
             this.routes = routes;
             this.suspendOnly = suspendOnly;
             this.abortAfterTimeout = abortAfterTimeout;
+            this.timeout = timeout;
+            this.timeUnit = timeUnit;
         }
 
         public void run() {
@@ -423,7 +428,7 @@ public class DefaultShutdownStrategy ext
                 if (size > 0) {
                     try {
                         LOG.info("Waiting as there are still " + size + " 
inflight and pending exchanges to complete, timeout in "
-                                 + (TimeUnit.SECONDS.convert(getTimeout(), 
getTimeUnit()) - (loopCount++ * loopDelaySeconds)) + " seconds.");
+                                 + (TimeUnit.SECONDS.convert(timeout, 
timeUnit) - (loopCount++ * loopDelaySeconds)) + " seconds.");
                         Thread.sleep(loopDelaySeconds * 1000);
                     } catch (InterruptedException e) {
                         if (abortAfterTimeout) {


Reply via email to