You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2005/11/21 21:41:46 UTC

svn commit: r347975 - /directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/util/LRUMap.java

Author: elecharny
Date: Mon Nov 21 12:41:37 2005
New Revision: 347975

URL: http://svn.apache.org/viewcvs?rev=347975&view=rev
Log:
The class is now final and protected methods are now private

Modified:
    directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/util/LRUMap.java

Modified: directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/util/LRUMap.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/util/LRUMap.java?rev=347975&r1=347974&r2=347975&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/util/LRUMap.java (original)
+++ directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/util/LRUMap.java Mon Nov 21 12:41:37 2005
@@ -48,7 +48,7 @@
  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
  * @author <a href="mailto:morgand@apache.org">Morgan Delagrange</a>
  */
-public class LRUMap extends SequencedHashMap implements Externalizable {
+public final class LRUMap extends SequencedHashMap implements Externalizable {
         
     private int maximumSize = 0;
 
@@ -120,7 +120,7 @@
 
         if ( mapSize >= maximumSize ) 
         {
-	        synchronized (this)
+	        synchronized ( this )
 	        {
 	            // don't retire LRU if you are just
 	            // updating an existing key
@@ -135,7 +135,10 @@
         }
         else
         {
-	        retval = super.put(key,value);
+        	synchronized ( this )
+        	{
+        		retval = super.put(key,value);
+        	}
         }
         
         return retval;
@@ -145,7 +148,7 @@
      * This method is used internally by the class for 
      * finding and removing the LRU Object.
      */
-    protected void removeLRU() 
+    private void removeLRU() 
     {
         Object key = getFirstKey();
         // be sure to call super.get(key), or you're likely to 
@@ -155,19 +158,6 @@
         remove(key);
     }
 
-    /**
-     * Subclasses of LRUMap may hook into this method to
-     * provide specialized actions whenever an Object is
-     * automatically removed from the cache.  By default,
-     * this method does nothing.
-     * 
-     * @param key    key that was removed
-     * @param value  value of that key (can be null)
-     */
-    protected void processRemovedLRU(Object key, Object value) 
-    {
-    }
- 
     // Externalizable interface
     //-------------------------------------------------------------------------        
     public void readExternal( ObjectInput in )  throws IOException, ClassNotFoundException