You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mb...@apache.org on 2014/01/03 20:59:31 UTC

svn commit: r1555239 - /commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/stub/TrainingContext.java

Author: mbenson
Date: Fri Jan  3 19:59:30 2014
New Revision: 1555239

URL: http://svn.apache.org/r1555239
Log:
synchronization

Modified:
    commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/stub/TrainingContext.java

Modified: commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/stub/TrainingContext.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/stub/TrainingContext.java?rev=1555239&r1=1555238&r2=1555239&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/stub/TrainingContext.java (original)
+++ commons/proper/proxy/branches/version-2.0-work/core/src/main/java/org/apache/commons/proxy2/stub/TrainingContext.java Fri Jan  3 19:59:30 2014
@@ -35,7 +35,7 @@ class TrainingContext
         return TRAINING_CONTEXT.get();
     }
 
-    static TrainingContext join(ProxyFactory proxyFactory)
+    static synchronized TrainingContext join(ProxyFactory proxyFactory)
     {
         final TrainingContext context = new TrainingContext(proxyFactory);
         TRAINING_CONTEXT.set(context);
@@ -58,13 +58,16 @@ class TrainingContext
 
     void part()
     {
-        if (resume == null)
+        synchronized (TRAINING_CONTEXT)
         {
-            TRAINING_CONTEXT.remove();
-        }
-        else
-        {
-            TRAINING_CONTEXT.set(resume);
+            if (resume == null)
+            {
+                TRAINING_CONTEXT.remove();
+            }
+            else
+            {
+                TRAINING_CONTEXT.set(resume);
+            }
         }
     }