Package emissary.util

Class DisposeHelper


  • public final class DisposeHelper
    extends Object
    Helper methods to ease handling of Dispose objects Dispose objects are added to BDOs to handle clean-up after a SeekableByteChannelFactory is finished with
    • Method Detail

      • add

        public static void add​(IBaseDataObject ibdo,
                               Runnable newRunnable)
        Add a Dispose object to a BDO
        Parameters:
        ibdo - to add the Runnable to
        newRunnable - to handle disposing of the referenced object
      • add

        public static void add​(IBaseDataObject ibdo,
                               List<Runnable> newRunnables)
        Add a list of Dispose objects to a BDO (additive to existing Dispose objects)
        Parameters:
        ibdo - to add the Runnables to
        newRunnables - list of Runnables to add
      • set

        public static void set​(IBaseDataObject ibdo,
                               Runnable newRunnable)
        Set a single Dispose object to a BDO (overwrites any existing Dispose objects)
        Parameters:
        ibdo - to add the Runnable to
        newRunnable - to handle disposing of the referenced object
      • get

        public static List<Runnable> get​(IBaseDataObject ibdo)
        Get the list of Runnables for an object. If an object provided by the key is not a valid Runnable, it will be ignored.
        Parameters:
        ibdo - to get Runnables from
        Returns:
        the list of Runnables
      • execute

        public static void execute​(List<IBaseDataObject> ibdos)
        Execute Runnables on provided objects. Execution will be for each object in the order provided.
        Parameters:
        ibdos - to execute runnables from
      • execute

        public static void execute​(IBaseDataObject ibdo)
        Execute Runnables for the specified object.
        Parameters:
        ibdo - to execute Runnables on