Interface LazyCleaner

  • All Known Implementing Classes:
    LazyCleanerImpl

    public interface LazyCleaner
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  LazyCleaner.Cleanable<T extends java.lang.Throwable>
      Cleanable interface for objects that can be manually cleaned.
      static interface  LazyCleaner.CleaningAction<T extends java.lang.Throwable>
      CleaningAction interface for cleanup actions that are notified whether cleanup occurred due to a leak (automatic) or manual cleanup.
    • Method Detail

      • register

        <T extends java.lang.Throwable> LazyCleaner.Cleanable<T> register​(java.lang.Object obj,
                                                                          LazyCleaner.CleaningAction<T> action)
        Registers an object for cleanup when it becomes phantom reachable.
        Type Parameters:
        T - the type of exception that can be thrown during cleanup
        Parameters:
        obj - the object to monitor for cleanup (should not be the same as action)
        action - the action to perform when the object becomes unreachable
        Returns:
        a Cleanable that can be used to manually trigger cleanup