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/07/25 14:02:26 UTC
svn commit: r1150651 -
/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java
Author: ningjiang
Date: Mon Jul 25 12:02:26 2011
New Revision: 1150651
URL: http://svn.apache.org/viewvc?rev=1150651&view=rev
Log:
CAMEL-4264 The routeContext stack of DefaultUnitOfWork should be thread safe
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=1150651&r1=1150650&r2=1150651&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 Jul 25 12:02:26 2011
@@ -261,21 +261,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 (routeContext) {
+ 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) {