directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r191960 - /directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/invocation/InvocationStack.java
Date Wed, 22 Jun 2005 14:45:37 GMT
Author: trustin
Date: Wed Jun 22 07:45:37 2005
New Revision: 191960

URL: http://svn.apache.org/viewcvs?rev=191960&view=rev
Log:
Forgot to synchronized InvocationStack.stacks.

Modified:
    directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/invocation/InvocationStack.java

Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/invocation/InvocationStack.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/invocation/InvocationStack.java?rev=191960&r1=191959&r2=191960&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/invocation/InvocationStack.java
(original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/invocation/InvocationStack.java
Wed Jun 22 07:45:37 2005
@@ -21,10 +21,14 @@
     public static InvocationStack getInstance()
     {
         Thread currentThread = Thread.currentThread();
-        InvocationStack ctx = ( InvocationStack ) stacks.get( currentThread );
-        if( ctx == null )
+        InvocationStack ctx;
+        synchronized( stacks )
         {
-            ctx = new InvocationStack();
+            ctx = ( InvocationStack ) stacks.get( currentThread );
+            if( ctx == null )
+            {
+                ctx = new InvocationStack();
+            }
         }
         return ctx;
     }
@@ -36,6 +40,7 @@
     {
         Thread currentThread = Thread.currentThread();
         this.thread = currentThread;
+        // This operation is already synchronized from getInstance()
         stacks.put( currentThread, this );
     }
     
@@ -61,7 +66,10 @@
         Invocation invocation = ( Invocation ) this.stack.remove( 0 );
         if( this.stack.size() == 0 )
         {
-            stacks.remove( thread );
+            synchronized( stacks )
+            {
+                stacks.remove( thread );
+            }
         }
 
         return invocation;



Mime
View raw message