franz1981 commented on a change in pull request #2645: ARTEMIS-2321 Paging 
scalability and GC improvement
URL: https://github.com/apache/activemq-artemis/pull/2645#discussion_r279271513
 
 

 ##########
 File path: 
artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SoftValueLongObjectHashMap.java
 ##########
 @@ -21,26 +21,26 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
-import java.util.concurrent.atomic.AtomicLong;
 
+import io.netty.util.collection.LongObjectHashMap;
+import io.netty.util.collection.LongObjectMap;
 import org.jboss.logging.Logger;
 
-public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> 
implements Map<K, V> {
+public class SoftValueLongObjectHashMap<V extends 
SoftValueLongObjectHashMap.ValueCache> implements LongObjectMap<V> {
 
-   private static final Logger logger = 
Logger.getLogger(SoftValueHashMap.class);
+   private static final Logger logger = 
Logger.getLogger(SoftValueLongObjectHashMap.class);
 
    // The soft references that are already good.
    // too bad there's no way to override the queue method on ReferenceQueue, 
so I wouldn't need this
    private final ReferenceQueue<V> refQueue = new ReferenceQueue<>();
 
-   private final Map<K, AggregatedSoftReference> mapDelegate = new HashMap<>();
+   private final LongObjectMap<AggregatedSoftReference<V>> mapDelegate = new 
LongObjectHashMap<>();
 
 Review comment:
   That's clear to me, but let me explain better what I mean...
   If we have:
   ```
   private final LongObjectMap<AggregatedSoftReference<V>> mapDelegate
   ```
   and externally we provide:
   ```
   //(1)
   V put(long k, V value) {
       return mapDelegate.put(k, value);
   }
   
   //(2)
   V put(Long k, V value) {
       return mapDelegate.put(k, value);
   }
   ```
   If caller will call (1), the javac will hide a boxing (long -> Long) to 
allow calling `map.put(k, value)` given that 
   mapDelegate has been declared as `Map<Long,...`.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to