aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap.java')
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap.java15
1 files changed, 5 insertions, 10 deletions
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap.java
index d9fd2ed293..fa5f160536 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap.java
@@ -81,7 +81,7 @@ public abstract class ReferenceValueMap<K, V> extends AbstractMap<K, V> implemen
{
if (ref.get() == null)
{
- ref.enqueue();
+ // ref.enqueue();
return false;
}
@@ -104,7 +104,7 @@ public abstract class ReferenceValueMap<K, V> extends AbstractMap<K, V> implemen
V v = ref.get();
if (v == null)
{
- ref.enqueue();
+ // ref.enqueue();
return false;
}
@@ -226,7 +226,8 @@ public abstract class ReferenceValueMap<K, V> extends AbstractMap<K, V> implemen
KeyedReference<K, V> ref;
while ((ref = (KeyedReference<K, V>)queue.poll()) != null)
{
- map.remove(ref.getKey());
+ // Slightly faster than map.get() + map.remove()
+ map.remove(ref.getKey(), ref);
}
}
}
@@ -238,13 +239,7 @@ public abstract class ReferenceValueMap<K, V> extends AbstractMap<K, V> implemen
return null;
}
- V value = ref.get();
- if (value == null)
- {
- ref.enqueue();
- }
-
- return value;
+ return ref.get();
}
protected abstract KeyedReference<K, V> createReference(K key, V value, ReferenceQueue<V> queue);