accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From keith-turner <...@git.apache.org>
Subject [GitHub] accumulo pull request #251: ACCUMULO-4626 added weak reference value map for...
Date Mon, 24 Apr 2017 15:24:53 GMT
Github user keith-turner commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/251#discussion_r112977010
  
    --- Diff: core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/TinyLfuBlockCache.java
---
    @@ -48,12 +52,13 @@
       private final Cache<String,Block> cache;
       private final Policy.Eviction<String,Block> policy;
       private final ScheduledExecutorService statsExecutor;
    +  private final Map<String,CacheEntry> weakEvictionMap = new MapMaker().weakValues().makeMap();
     
       public TinyLfuBlockCache(long maxSize, long blockSize) {
         cache = Caffeine.newBuilder().initialCapacity((int) Math.ceil(1.2 * maxSize / blockSize)).weigher((String
blockName, Block block) -> {
           int keyWeight = ClassSize.align(blockName.length()) + ClassSize.STRING;
           return keyWeight + block.weight();
    -    }).maximumWeight(maxSize).recordStats().build();
    +    }).maximumWeight(maxSize).recordStats().removalListener((String key, Block block,
RemovalCause cause) -> weakEvictionMap.put(key, block)).build();
    --- End diff --
    
    Do you know if the removal listener is called before or after the entry is removed from
the cache?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message