camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r965766 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/impl/DefaultPollingConsumerPollStrategy.java components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFilePollingConsumerPollStrategy.java
Date Tue, 20 Jul 2010 09:20:00 GMT
Author: davsclaus
Date: Tue Jul 20 09:20:00 2010
New Revision: 965766

URL: http://svn.apache.org/viewvc?rev=965766&view=rev
Log:
CAMEL-2969: Less verbose logging when errors occur during shutdown of polling consumers.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultPollingConsumerPollStrategy.java
    camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFilePollingConsumerPollStrategy.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultPollingConsumerPollStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultPollingConsumerPollStrategy.java?rev=965766&r1=965765&r2=965766&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultPollingConsumerPollStrategy.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultPollingConsumerPollStrategy.java
Tue Jul 20 09:20:00 2010
@@ -24,6 +24,8 @@ import org.apache.commons.logging.LogFac
 
 /**
  * A default implementation that just logs a <tt>WARN</tt> level log in case
of rollback.
+ * <p/>
+ * The implement will <b>not</b> log if the rollback occurred during shutdown.
  *
  * @version $Revision$
  */
@@ -40,7 +42,16 @@ public class DefaultPollingConsumerPollS
     }
 
     public boolean rollback(Consumer consumer, Endpoint endpoint, int retryCounter, Exception
e) throws Exception {
-        log.warn("Consumer " + consumer +  " could not poll endpoint: " + endpoint.getEndpointUri()
+ " caused by: " + e.getMessage(), e);
+        boolean runAllowed = true;
+        if (consumer instanceof ServiceSupport) {
+            runAllowed = ((ServiceSupport) consumer).isRunAllowed();
+        }
+
+        // only log warn if we are running, otherwise we are just stopping which we should
not log the issue in the logs
+        if (runAllowed) {
+            log.warn("Consumer " + consumer +  " could not poll endpoint: " + endpoint.getEndpointUri()
+ " caused by: " + e.getMessage(), e);
+        }
+
         // we do not want to retry
         return false;
     }

Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFilePollingConsumerPollStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFilePollingConsumerPollStrategy.java?rev=965766&r1=965765&r2=965766&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFilePollingConsumerPollStrategy.java
(original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFilePollingConsumerPollStrategy.java
Tue Jul 20 09:20:00 2010
@@ -29,10 +29,20 @@ public class RemoteFilePollingConsumerPo
 
     @Override
     public boolean rollback(Consumer consumer, Endpoint endpoint, int retryCounter, Exception
e) throws Exception {
-        // disconnect from the server to force it to re login at next poll to recover
         RemoteFileConsumer rfc = (RemoteFileConsumer) consumer;
-        log.warn("Trying to recover by disconnecting from remote server forcing a re-connect
at next poll: " + rfc.remoteServer());
-        rfc.disconnect();
+
+        // only try to recover if we are allowed to run
+        if (((RemoteFileConsumer) consumer).isRunAllowed()) {
+            // disconnect from the server to force it to re login at next poll to recover
+            log.warn("Trying to recover by disconnecting from remote server forcing a re-connect
at next poll: " + rfc.remoteServer());
+            try {
+                rfc.disconnect();
+            } catch (Throwable t) {
+                // ignore the exception
+                log.debug("Error occurred during disconnect from: " + rfc.remoteServer()
+ ". This example will be ignored.", t);
+            }
+        }
+
         return super.rollback(consumer, endpoint, retryCounter, e);
     }
 



Mime
View raw message