You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2011/08/26 03:52:48 UTC

svn commit: r1161960 - in /camel/branches/camel-2.8.x: ./ camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java

Author: ningjiang
Date: Fri Aug 26 01:52:48 2011
New Revision: 1161960

URL: http://svn.apache.org/viewvc?rev=1161960&view=rev
Log:
Merged revisions 1150651,1151054 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1150651 | ningjiang | 2011-07-25 20:02:26 +0800 (Mon, 25 Jul 2011) | 1 line
  
  CAMEL-4264 The routeContext stack of DefaultUnitOfWork should be thread safe
........
  r1151054 | cmueller | 2011-07-26 18:21:11 +0800 (Tue, 26 Jul 2011) | 1 line
  
  CAMEL-4264: The routeContext stack of DefaultUnitOfWork should be thread safe - Thanks Matthias for pointing this out
........

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

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 26 01:52:48 2011
@@ -1 +1 @@
-/camel/trunk:1155230,1156108,1156260,1156524,1157348,1157798,1157831,1157878,1158153,1159171,1159174,1159457,1159460,1159606,1159867,1160547,1161010,1161524
+/camel/trunk:1150651,1151054,1155230,1156108,1156260,1156524,1157348,1157798,1157831,1157878,1158153,1159171,1159174,1159457,1159460,1159606,1159867,1160547,1161010,1161524

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/DefaultUnitOfWork.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java?rev=1161960&r1=1161959&r2=1161960&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java (original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java Fri Aug 26 01:52:48 2011
@@ -141,8 +141,10 @@ public class DefaultUnitOfWork implement
         if (transactedBy != null) {
             transactedBy.clear();
         }
-        if (!routeContextStack.isEmpty()) {
-            routeContextStack.clear();
+        synchronized (routeContextStack) {
+            if (!routeContextStack.isEmpty()) {
+                routeContextStack.clear();
+            }
         }
         if (subUnitOfWorks != null) {
             subUnitOfWorks.clear();
@@ -261,21 +263,27 @@ public class DefaultUnitOfWork implement
     }
 
     public RouteContext getRouteContext() {
-        if (routeContextStack.isEmpty()) {
-            return null;
+        synchronized (routeContextStack) {
+            if (routeContextStack.isEmpty()) {
+                return null;
+            }
+            return routeContextStack.peek();
         }
-        return routeContextStack.peek();
     }
 
     public void pushRouteContext(RouteContext routeContext) {
-        routeContextStack.add(routeContext);
+        synchronized (routeContextStack) {
+            routeContextStack.add(routeContext);
+        }
     }
 
     public RouteContext popRouteContext() {
-        if (routeContextStack.isEmpty()) {
-            return null;
+        synchronized (routeContextStack) {
+            if (routeContextStack.isEmpty()) {
+                return null;
+            }
+            return routeContextStack.pop();
         }
-        return routeContextStack.pop();
     }
 
     public AsyncCallback beforeProcess(Processor processor, Exchange exchange, AsyncCallback callback) {