camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r885400 - /camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java
Date Mon, 30 Nov 2009 12:41:36 GMT
Author: davsclaus
Date: Mon Nov 30 12:41:36 2009
New Revision: 885400

URL: http://svn.apache.org/viewvc?rev=885400&view=rev
Log:
Using try catch for event notifier in UoW done to ensure synchronizations always will be invoked
if event notifier failed, such as if using a custom notifier and it fails.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java?rev=885400&r1=885399&r2=885400&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java Mon
Nov 30 12:41:36 2009
@@ -110,10 +110,15 @@
         boolean failed = exchange.isFailed();
 
         // fire event to signal the exchange is done
-        if (failed) {
-            EventHelper.notifyExchangeFailed(exchange.getContext(), exchange);
-        } else {
-            EventHelper.notifyExchangeDone(exchange.getContext(), exchange);
+        try {
+            if (failed) {
+                EventHelper.notifyExchangeFailed(exchange.getContext(), exchange);
+            } else {
+                EventHelper.notifyExchangeDone(exchange.getContext(), exchange);
+            }
+        } catch (Exception e) {
+            // must catch exceptions to ensure synchronizations is also invoked
+            LOG.warn("Exception occurred during event notification. This exception will be
ignored.", e);
         }
 
         if (synchronizations != null && !synchronizations.isEmpty()) {
@@ -127,7 +132,7 @@
                     }
                 } catch (Exception e) {
                     // must catch exceptions to ensure all synchronizations have a chance
to run
-                    LOG.warn("Exception occurred during onCompletion. This exception will
be ignored: ", e);
+                    LOG.warn("Exception occurred during onCompletion. This exception will
be ignored.", e);
                 }
             }
         }
@@ -136,7 +141,6 @@
         if (exchange.getContext() != null) {
             exchange.getContext().getInflightRepository().remove(exchange);
         }
-
     }
 
     public String getId() {



Mime
View raw message