Interface Housekeeper

    • Method Detail

      • add

        <T> 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​(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