Class CloseableRegistry

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class CloseableRegistry
    extends Object
    implements Closeable
    A registry of Closeable instances.
    Since:
    0.5.0
    Version:
    $Id: CloseableRegistry.java 16154 2012-07-14 16:34:05Z colin $
    Author:
    tlerios@marketcetera.com
    • Constructor Detail

      • CloseableRegistry

        public CloseableRegistry()
    • Method Detail

      • register

        public void register​(Closeable closeable)
        Registers a Closeable instance with the receiver. An instance (dependent) that depends upon another instance (parent) must be registered after the parent.
        Parameters:
        closeable - The closeable.
      • close

        public void close()
        Closes all Closeable instances registered with the receiver. All instances are always closed, even if an error occurs while closing an instance; such errors are merely logged, but do not prevent further closures. The order of closures is the reverse of the registration order.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable