Package emissary.util
Class DisposeHelper
- java.lang.Object
-
- emissary.util.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 aSeekableByteChannelFactory
is finished with
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
add(IBaseDataObject ibdo, Runnable newRunnable)
Add a Dispose object to a BDOstatic void
add(IBaseDataObject ibdo, List<Runnable> newRunnables)
Add a list of Dispose objects to a BDO (additive to existing Dispose objects)static void
execute(IBaseDataObject ibdo)
Execute Runnables for the specified object.static void
execute(List<IBaseDataObject> ibdos)
Execute Runnables on provided objects.static List<Runnable>
get(IBaseDataObject ibdo)
Get the list of Runnables for an object.static void
set(IBaseDataObject ibdo, Runnable newRunnable)
Set a single Dispose object to a BDO (overwrites any existing Dispose objects)
-
-
-
Field Detail
-
KEY
public static final String KEY
Metadata key to use to store runnables in on a BDO.- See Also:
- Constant Field Values
-
-
Method Detail
-
add
public static void add(IBaseDataObject ibdo, Runnable newRunnable)
Add a Dispose object to a BDO- Parameters:
ibdo
- to add the Runnable tonewRunnable
- 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 tonewRunnables
- 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 tonewRunnable
- 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
-
-