Package com.google.inject.internal
Class WeakKeySet
- java.lang.Object
-
- com.google.inject.internal.WeakKeySet
-
final class WeakKeySet extends java.lang.Object
Minimal set that doesn't hold strong references to the contained keys.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
WeakKeySet.KeyAndSource
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<Key<?>,com.google.common.collect.Multiset<java.lang.Object>>
backingMap
private com.google.common.cache.Cache<InjectorBindingData,java.util.Set<WeakKeySet.KeyAndSource>>
evictionCache
Tracks child injector lifetimes and evicts banned keys/sources after the child injector is garbage collected.private java.lang.Object
lock
This is already locked externally on add and getSources but we need it to handle clean up in the evictionCache's RemovalListener.
-
Constructor Summary
Constructors Constructor Description WeakKeySet(java.lang.Object lock)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Key<?> key, InjectorBindingData state, java.lang.Object source)
private void
cleanupOnRemoval(com.google.common.cache.RemovalNotification<InjectorBindingData,java.util.Set<WeakKeySet.KeyAndSource>> notification)
boolean
contains(Key<?> key)
java.util.Set<java.lang.Object>
getSources(Key<?> key)
-
-
-
Field Detail
-
backingMap
private java.util.Map<Key<?>,com.google.common.collect.Multiset<java.lang.Object>> backingMap
-
lock
private final java.lang.Object lock
This is already locked externally on add and getSources but we need it to handle clean up in the evictionCache's RemovalListener.
-
evictionCache
private final com.google.common.cache.Cache<InjectorBindingData,java.util.Set<WeakKeySet.KeyAndSource>> evictionCache
Tracks child injector lifetimes and evicts banned keys/sources after the child injector is garbage collected.
-
-
Method Detail
-
cleanupOnRemoval
private void cleanupOnRemoval(com.google.common.cache.RemovalNotification<InjectorBindingData,java.util.Set<WeakKeySet.KeyAndSource>> notification)
-
add
public void add(Key<?> key, InjectorBindingData state, java.lang.Object source)
-
contains
public boolean contains(Key<?> key)
-
getSources
public java.util.Set<java.lang.Object> getSources(Key<?> key)
-
-