Java 8 migration. Replace Collection.newSetFromMap with ConcurrentHashMap.newKeySet (#8756)
Motivation: Simplify code with newer Java API. It also reduce levels of indirection, but I don't think we can gain any visible performance improvements out of this. Modifications: Replace Collection.newSetFromMap(new ConcurrentHashMap()) with ConcurrentHashMap.newKeySet(). Result: Use Java8 APIs.
This commit is contained in:
parent
9d62deeb6f
commit
b3500f50a6
@ -26,7 +26,6 @@ import java.lang.ref.WeakReference;
|
||||
import java.lang.ref.ReferenceQueue;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -164,8 +163,7 @@ public class ResourceLeakDetector<T> {
|
||||
}
|
||||
|
||||
/** the collection of active resources */
|
||||
private final Set<DefaultResourceLeak<?>> allLeaks =
|
||||
Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||
private final Set<DefaultResourceLeak<?>> allLeaks = ConcurrentHashMap.newKeySet();
|
||||
|
||||
private final ReferenceQueue<Object> refQueue = new ReferenceQueue<>();
|
||||
private final ConcurrentMap<String, Boolean> reportedLeaks = PlatformDependent.newConcurrentHashMap();
|
||||
|
Loading…
Reference in New Issue
Block a user