Interface LazyCleaner

All Known Implementing Classes:
LazyCleanerImpl

public interface LazyCleaner
  • Method Details

    • register

      <T extends Throwable> LazyCleaner.Cleanable<T> register(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