Package io.deephaven.base.cache
Class RetentionCache<TYPE>
java.lang.Object
io.deephaven.base.cache.RetentionCache<TYPE>
Utility for holding strong references to otherwise unreachable classes (e.g. listeners that will be weakly held by
the object they subscribe to).
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Ask this RetentionCache to forget about a reference.void
Ask this RetentionCache to forget all the references it's remembering.Ask this RetentionCache to hold on to a reference in order to ensure thatreferent
remains strongly-reachable for the garbage collector.
-
Constructor Details
-
RetentionCache
public RetentionCache()
-
-
Method Details
-
retain
Ask this RetentionCache to hold on to a reference in order to ensure thatreferent
remains strongly-reachable for the garbage collector.- Parameters:
referent
- The object to hold a reference to- Returns:
referent
, for convenience when retaining anonymous class instances
-
forget
Ask this RetentionCache to forget about a reference.- Parameters:
referent
- The referent to forget the reference to
-
forgetAll
public void forgetAll()Ask this RetentionCache to forget all the references it's remembering.
-