Package com.complexible.common.base
Class Disposer
- java.lang.Object
-
- com.complexible.common.base.Disposer
-
- All Implemented Interfaces:
Disposable
public final class Disposer extends java.lang.Object implements Disposable
Utility for tracking and mass
Disposable.dispose()
ofDisposable
resources.- Since:
- 5.0
- Version:
- 5.0
- Author:
- Michael Grove
-
-
Constructor Summary
Constructors Constructor Description Disposer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Dispose the resources held by this object.<T extends Disposable>
Tregister(T theToDispose)
Add a newDisposable
for tracking to this `Disposer`
-
-
-
Method Detail
-
register
public <T extends Disposable> T register(T theToDispose)
Add a newDisposable
for tracking to this `Disposer`- Parameters:
theToDispose
- the object to eventually dispose of- Returns:
- this disposer
-
dispose
public void dispose()
Dispose the resources held by this object. Use this function with care since disposed objects cannot be reused again. If the resources (files, pages, etc.) held by this object will be needed again callingCloseable.close()
or some other method will be more appropriate.- Specified by:
dispose
in interfaceDisposable
-
-