[infinispan-commits] Infinispan SVN: r1444 - trunk/core/src/main/java/org/infinispan/util/concurrent.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Tue Feb 2 15:53:00 EST 2010


Author: vblagojevic at jboss.com
Date: 2010-02-02 15:52:59 -0500 (Tue, 02 Feb 2010)
New Revision: 1444

Modified:
   trunk/core/src/main/java/org/infinispan/util/concurrent/BufferedConcurrentHashMap.java
Log:
slight modification to match BP-Wrapper algorithm

Modified: trunk/core/src/main/java/org/infinispan/util/concurrent/BufferedConcurrentHashMap.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/util/concurrent/BufferedConcurrentHashMap.java	2010-02-02 16:07:44 UTC (rev 1443)
+++ trunk/core/src/main/java/org/infinispan/util/concurrent/BufferedConcurrentHashMap.java	2010-02-02 20:52:59 UTC (rev 1444)
@@ -599,16 +599,22 @@
                     }                    
                 } else {
                     oldValue = null;
-                    ++modCount;
-                    tab[index] = new HashEntry<K, V>(key, hash, first, value);
+                    ++modCount;                    
                     count = c; // write-volatile
-                    if (ea.strategy() != EvictionStrategy.NONE) {                       
-                        ea.onEntryMiss(tab[index]);                        
-                        if (c > tab.length) {                           
-                            // remove elements and thus lower count
+                    if (ea.strategy() != EvictionStrategy.NONE) {
+                        if (c > tab.length) {
+                            // remove entries;lower count
                             evicted = ea.execute();
                             assert !evicted.isEmpty();
+                            // re-read first
+                            first = tab[index];
                         }
+                        // add a new entry
+                        tab[index] = new HashEntry<K, V>(key, hash, first, value);
+                        // notify a miss
+                        ea.onEntryMiss(tab[index]);
+                    } else {
+                        tab[index] = new HashEntry<K, V>(key, hash, first, value);
                     }
                 }
                 return oldValue;



More information about the infinispan-commits mailing list