Repository: groovy Updated Branches: refs/heads/master afac5ed6d -> 29791eb42
Refine `ConcurrentLinkedHashMap` to create node accurately Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/29791eb4 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/29791eb4 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/29791eb4 Branch: refs/heads/master Commit: 29791eb4258b74027b9eec500c3393ad12755d4b Parents: afac5ed Author: sunlan <[email protected]> Authored: Mon Jan 8 17:54:56 2018 +0800 Committer: sunlan <[email protected]> Committed: Mon Jan 8 17:54:56 2018 +0800 ---------------------------------------------------------------------- .../util/concurrentlinkedhashmap/ConcurrentLinkedHashMap.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/29791eb4/src/main/java/org/apache/groovy/util/concurrentlinkedhashmap/ConcurrentLinkedHashMap.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/groovy/util/concurrentlinkedhashmap/ConcurrentLinkedHashMap.java b/src/main/java/org/apache/groovy/util/concurrentlinkedhashmap/ConcurrentLinkedHashMap.java index f368bd8..38173cd 100644 --- a/src/main/java/org/apache/groovy/util/concurrentlinkedhashmap/ConcurrentLinkedHashMap.java +++ b/src/main/java/org/apache/groovy/util/concurrentlinkedhashmap/ConcurrentLinkedHashMap.java @@ -779,8 +779,8 @@ public final class ConcurrentLinkedHashMap<K, V> extends AbstractMap<K, V> Node<K, V> node = objectHolder.getObject(); if (null == node) { - V value = null; - final int weight = 1; // weigher.weightOf(key, value); + V value = prior.getValue(); + final int weight = weigher.weightOf(key, value); final WeightedValue<V> weightedValue = new WeightedValue<V>(value, weight); node = new Node<K, V>(key, weightedValue); } else {
