Class RetentionCache<TYPE>

java.lang.Object
io.deephaven.base.cache.RetentionCache<TYPE>

public class RetentionCache<TYPE> extends Object
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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    forget(TYPE referent)
    Ask this RetentionCache to forget about a reference.
    void
    Ask this RetentionCache to forget all the references it's remembering.
    retain(TYPE referent)
    Ask this RetentionCache to hold on to a reference in order to ensure that referent remains strongly-reachable for the garbage collector.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RetentionCache

      public RetentionCache()
  • Method Details

    • retain

      public TYPE retain(@NotNull TYPE referent)
      Ask this RetentionCache to hold on to a reference in order to ensure that referent 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

      public void forget(@NotNull TYPE referent)
      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.