[mule-scm] [mule] [15984] branches/mule-3.x/core/src/main/java/org/mule/model/resolvers/AbstractEntryPointResolver.java: Added a flag to synchronize calls to the component object, by default it is false

View: New views
1 Messages — Rating Filter:   Alert me  

[mule-scm] [mule] [15984] branches/mule-3.x/core/src/main/java/org/mule/model/resolvers/AbstractEntryPointResolver.java: Added a flag to synchronize calls to the component object, by default it is false

by rossmason :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
[mule] [15984] branches/mule-3.x/core/src/main/java/org/mule/model/resolvers/AbstractEntryPointResolver.java: Added a flag to synchronize calls to the component object, by default it is false
Revision
15984
Author
rossmason
Date
2009-11-05 18:12:55 -0600 (Thu, 05 Nov 2009)

Log Message

Added a flag to synchronize calls to the component object, by default it is false

Modified Paths

Diff

Modified: branches/mule-3.x/core/src/main/java/org/mule/model/resolvers/AbstractEntryPointResolver.java (15983 => 15984)

--- branches/mule-3.x/core/src/main/java/org/mule/model/resolvers/AbstractEntryPointResolver.java	2009-11-05 17:29:56 UTC (rev 15983)
+++ branches/mule-3.x/core/src/main/java/org/mule/model/resolvers/AbstractEntryPointResolver.java	2009-11-06 00:12:55 UTC (rev 15984)
@@ -22,7 +22,6 @@
 import java.lang.reflect.Method;
 
 import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -41,6 +40,7 @@
 
     private boolean acceptVoidMethods = false;
 
+    private boolean synchronizeCall = false;
 
     // @GuardedBy(itself)
     protected final ConcurrentHashMap methodCache = new ConcurrentHashMap(4);
@@ -151,7 +151,20 @@
             logger.debug("Invoking " + methodCall);
         }
 
-        Object result = method.invoke(component, arguments);
+        Object result;
+
+        if(isSynchronizeCall())
+        {
+            synchronized (component)
+            {
+                result = method.invoke(component, arguments);
+            }
+        }
+        else
+        {
+            result = method.invoke(component, arguments);
+        }
+
         if (method.getReturnType().equals(Void.TYPE))
         {
             result = VoidResult.getInstance();
@@ -165,7 +178,16 @@
         return new InvocationResult(result, method);
     }
 
+    public boolean isSynchronizeCall()
+    {
+        return synchronizeCall;
+    }
 
+    public void setSynchronizeCall(boolean synchronizeCall)
+    {
+        this.synchronizeCall = synchronizeCall;
+    }
+
     public String toString()
     {
         final StringBuffer sb = new StringBuffer();


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email