synapse-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hira...@apache.org
Subject svn commit: r813354 - in /synapse/trunk/java/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:23:39 GMT
Author: hiranya
Date: Thu Sep 10 10:23:39 2009
New Revision: 813354

URL: http://svn.apache.org/viewvc?rev=813354&view=rev
Log:
Synchronization to prevent the same dynamic endpoint/sequence from being initialized multiple
times


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

Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2MessageContext.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2MessageContext.java?rev=813354&r1=813353&r2=813354&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2MessageContext.java
(original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2MessageContext.java
Thu Sep 10 10:23:39 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/trunk/java/modules/core/src/test/java/org/apache/synapse/TestMessageContext.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/TestMessageContext.java?rev=813354&r1=813353&r2=813354&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/TestMessageContext.java
(original)
+++ synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/TestMessageContext.java
Thu Sep 10 10:23:39 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