directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r965751 - /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryCache.java
Date Tue, 20 Jul 2010 08:21:33 GMT
Author: elecharny
Date: Tue Jul 20 08:21:33 2010
New Revision: 965751

URL: http://svn.apache.org/viewvc?rev=965751&view=rev
Log:
Made the subentry cache thread safe

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryCache.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryCache.java?rev=965751&r1=965750&r2=965751&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryCache.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryCache.java
Tue Jul 20 08:21:33 2010
@@ -20,9 +20,9 @@
 package org.apache.directory.server.core.subtree;
 
 
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.directory.shared.ldap.name.DN;
@@ -55,7 +55,7 @@ public class SubentryCache implements It
      */
     public SubentryCache()
     {
-        cache = new HashMap<DN, Subentry>();
+        cache = new ConcurrentHashMap<DN, Subentry>();
         cacheSize = new AtomicInteger( 0 );
     }
     
@@ -65,7 +65,7 @@ public class SubentryCache implements It
      */
     public SubentryCache( int maxSize )
     {
-        cache = new HashMap<DN, Subentry>();
+        cache = new ConcurrentHashMap<DN, Subentry>();
         cacheSize = new AtomicInteger( 0 );
         cacheMaxSize = maxSize;
     }
@@ -92,7 +92,6 @@ public class SubentryCache implements It
      */
     final Subentry removeSubentry( DN dn )
     {
-        int k = dn.hashCode();
         Subentry oldSubentry = cache.remove( dn );
         
         if ( oldSubentry != null )
@@ -114,7 +113,6 @@ public class SubentryCache implements It
      */
     /* No qualifier */ Subentry addSubentry( DN dn, Subentry subentry )
     {
-        int k = dn.hashCode();
         if ( cacheSize.get() > cacheMaxSize )
         {
             // TODO : Throw an exception here



Mime
View raw message