plumb JetForcer plugin usage suddenly appeared out of blue moon

This commit is contained in:
Alexey Kudravtsev
2018-01-18 16:28:42 +03:00
parent a29a15607a
commit a08176bbf9
2 changed files with 19 additions and 2 deletions
@@ -2789,7 +2789,7 @@ public class ContainerUtil extends ContainerUtilRt {
}
@NotNull
public static <K,V> Map<K,V> createSoftKeySoftValueMap() {
return new SoftKeySoftValueHashMap<K, V>();
return new SoftKeySoftValueHashMap<K, V>(true);
}
/**
@@ -15,16 +15,32 @@
*/
package com.intellij.util.containers;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;
import java.util.*;
final class SoftKeySoftValueHashMap<K,V> implements Map<K,V>{
/**
* @deprecated use {@link ContainerUtil#createSoftKeySoftValueMap()} instead
*/
@Deprecated
public final class SoftKeySoftValueHashMap<K,V> implements Map<K,V>{
private static final Logger LOG = Logger.getInstance(SoftKeySoftValueHashMap.class);
private final RefHashMap<K, ValueReference<K,V>> mySoftKeyMap = (RefHashMap<K, ValueReference<K,V>>)ContainerUtil.<K, ValueReference<K,V>>createSoftMap();
private final ReferenceQueue<V> myQueue = new ReferenceQueue<V>();
@Deprecated
public SoftKeySoftValueHashMap() {
LOG.warn("This class is deprecated. Please use {@link ContainerUtil#createSoftKeySoftValueMap()} instead.", new IncorrectOperationException());
}
SoftKeySoftValueHashMap(boolean goodConstructor) {
}
private static class ValueReference<K,V> extends SoftReference<V> {
private final RefHashMap.Key<K> key;
@@ -38,6 +54,7 @@ final class SoftKeySoftValueHashMap<K,V> implements Map<K,V>{
boolean processQueue() {
boolean processed = mySoftKeyMap.processQueue();
while(true) {
@SuppressWarnings("unchecked")
ValueReference<K,V> ref = (ValueReference<K, V>)myQueue.poll();
if (ref == null) break;
RefHashMap.Key<K> key = ref.key;