Class Disposer

java.lang.Object
com.complexible.common.base.Disposer
All Implemented Interfaces:
Disposable

public final class Disposer extends Object implements Disposable

Utility for tracking and mass Disposable.dispose() of Disposable resources.

Since:
5.0
Version:
5.0
Author:
Michael Grove
  • Constructor Details

    • Disposer

      public Disposer()
  • Method Details

    • register

      public <T extends Disposable> T register(T theToDispose)
      Add a new Disposable 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 calling Closeable.close() or some other method will be more appropriate.
      Specified by:
      dispose in interface Disposable