Class ResourceCleaner

    • Method Detail

      • register

        public static Cleaner.Cleanable register​(Object instance,
                                                 Runnable action)
        Register an object and an action to clean up resources associated with the object once the object instance becomes phantom unreachable.
        Parameters:
        instance - the instance to monitor
        action - the action to run for the clean up
        Returns:
        a cleanable instance
        See Also:
        Cleaner