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 2010/02/04 08:07:17 UTC

svn commit: r906381 - /camel/trunk/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java

Author: davsclaus
Date: Thu Feb  4 07:07:16 2010
New Revision: 906381

URL: http://svn.apache.org/viewvc?rev=906381&view=rev
Log:
CAMEL-2445: BatchProcessor now catches throwable and logs them

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java?rev=906381&r1=906380&r2=906381&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java Thu Feb  4 07:07:16 2010
@@ -299,11 +299,8 @@
                             try {
                                 sendExchanges();
                             } catch (Throwable t) {
-                                if (t instanceof Exception) {
-                                    getExceptionHandler().handleException(t);
-                                } else {
-                                    getExceptionHandler().handleException(new CamelException(t));
-                                }
+                                // a fail safe to handle all exceptions being thrown
+                                getExceptionHandler().handleException(new CamelException(t));
                             }
                         } finally {
                             queueLock.lock();
@@ -361,7 +358,12 @@
             while (iter.hasNext()) {
                 Exchange exchange = iter.next();
                 iter.remove();
-                processExchange(exchange);
+                try {
+                    processExchange(exchange);
+                } catch (Throwable t) {
+                    // must catch throwable to avoid growing memory
+                    getExceptionHandler().handleException("Error processing Exchange: " + exchange, t);
+                }
             }
         }
     }