synapse-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hira...@apache.org
Subject svn commit: r813352 - in /synapse/branches/1.3/modules/core/src: main/java/org/apache/synapse/core/axis2/Axis2MessageContext.java test/java/org/apache/synapse/TestMessageContext.java
Date Thu, 10 Sep 2009 10:21:19 GMT
Author: hiranya
Date: Thu Sep 10 10:21:19 2009
New Revision: 813352

URL: http://svn.apache.org/viewvc?rev=813352&view=rev
Log:
Implemented some synchronization to prevent the same dynamic endpoint/sequence from getting
initialized multiple times by different threads. 


Modified:
    synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2MessageContext.java
    synapse/branches/1.3/modules/core/src/test/java/org/apache/synapse/TestMessageContext.java

Modified: synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2MessageContext.java
URL: http://svn.apache.org/viewvc/synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2MessageContext.java?rev=813352&r1=813351&r2=813352&view=diff
==============================================================================
--- synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2MessageContext.java
(original)
+++ synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2MessageContext.java
Thu Sep 10 10:21:19 2009
@@ -133,8 +133,13 @@
             return (Mediator) o;
         } else {
             Mediator m = getConfiguration().getSequence(key);
-            if (m instanceof SequenceMediator && !((SequenceMediator) m).isInitialized())
{
-                ((SequenceMediator) m).init(synEnv);
+            if (m instanceof SequenceMediator) {
+                SequenceMediator seqMediator = (SequenceMediator) m;
+                synchronized (m) {
+                    if (!seqMediator.isInitialized()) {
+                        seqMediator.init(synEnv);
+                    }
+                }
             }
             localEntries.put(key, m);
             return m;
@@ -147,8 +152,10 @@
             return (Endpoint) o;
         } else {
             Endpoint e = getConfiguration().getEndpoint(key);
-            if (!e.isInitialized()) {
-                e.init(synEnv);
+            synchronized (e) {
+                if (!e.isInitialized()) {
+                    e.init(synEnv);
+                }
             }
             localEntries.put(key, e);
             return e;

Modified: synapse/branches/1.3/modules/core/src/test/java/org/apache/synapse/TestMessageContext.java
URL: http://svn.apache.org/viewvc/synapse/branches/1.3/modules/core/src/test/java/org/apache/synapse/TestMessageContext.java?rev=813352&r1=813351&r2=813352&view=diff
==============================================================================
--- synapse/branches/1.3/modules/core/src/test/java/org/apache/synapse/TestMessageContext.java
(original)
+++ synapse/branches/1.3/modules/core/src/test/java/org/apache/synapse/TestMessageContext.java
Thu Sep 10 10:21:19 2009
@@ -130,8 +130,13 @@
             return (Mediator) o;
         } else {
             Mediator m = getConfiguration().getSequence(key);
-            if (m instanceof SequenceMediator && !((SequenceMediator) m).isInitialized())
{
-                ((SequenceMediator) m).init(synEnv);
+            if (m instanceof SequenceMediator) {
+                SequenceMediator seqMediator = (SequenceMediator) m;
+                synchronized (m) {
+                    if (!seqMediator.isInitialized()) {
+                        seqMediator.init(synEnv);
+                    }
+                }
             }
             localEntries.put(key, m);
             return m;
@@ -144,8 +149,10 @@
             return (Endpoint) o;
         } else {
             Endpoint e = getConfiguration().getEndpoint(key);
-            if (!e.isInitialized()) {
-                e.init(synEnv);
+            synchronized (e) {
+                if (!e.isInitialized()) {
+                    e.init(synEnv);
+                }
             }
             localEntries.put(key, e);
             return e;



Mime
View raw message