Class WeakKeySet

java.lang.Object
com.google.inject.internal.WeakKeySet

final class WeakKeySet extends Object
Minimal set that doesn't hold strong references to the contained keys.
  • Field Details

    • backingMap

      private Map<Key<?>,com.google.common.collect.Multiset<Object>> backingMap
    • lock

      private final 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<State,Set<WeakKeySet.KeyAndSource>> evictionCache
      Tracks child injector lifetimes and evicts blacklisted keys/sources after the child injector is garbage collected.
  • Constructor Details

    • WeakKeySet

      WeakKeySet(Object lock)
  • Method Details

    • cleanupOnRemoval

      private void cleanupOnRemoval(com.google.common.cache.RemovalNotification<State,Set<WeakKeySet.KeyAndSource>> notification)
    • add

      public void add(Key<?> key, State state, Object source)
    • contains

      public boolean contains(Key<?> key)
    • getSources

      public Set<Object> getSources(Key<?> key)