Interface Housekeeper

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  Housekeeper.CleanupRunnable
      Cleanup runnable to execute when a reference needs to be cleaned up
      static interface  Housekeeper.Ref  
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <T> java.lang.Object add​(T referent, Housekeeper.CleanupRunnable cleanup)
      Associate a cleanup runnable to be run when a referent is only phantom reference-able.
      void emptyQueue()
      Ensures the cleanup queue is emptied immediately
      void remove​(java.lang.Object cleanupKey)
      Removes cleanup runnable for the given referent
      void setLogLeakedReferences​(boolean value)
      Enable/Disable leaked reference logging
    • Method Detail

      • add

        <T> java.lang.Object add​(T referent,
                                 Housekeeper.CleanupRunnable cleanup)
        Associate a cleanup runnable to be run when a referent is only phantom reference-able.
        Parameters:
        referent - Reference to track
        cleanup - Runnable to run when referent is phantom-ed
        Returns:
        Key object to use when calling remove
      • remove

        void remove​(java.lang.Object cleanupKey)
        Removes cleanup runnable for the given referent
        Parameters:
        cleanupKey - Key to reference to stop tracking
      • emptyQueue

        void emptyQueue()
        Ensures the cleanup queue is emptied immediately
      • setLogLeakedReferences

        void setLogLeakedReferences​(boolean value)
        Enable/Disable leaked reference logging