Class Disposer

    • 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>
      T
      register​(T theToDispose)
      Add a new Disposable for tracking to this `Disposer`
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Disposer

        public Disposer()
    • Method Detail

      • 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