org.marketcetera.util.file
Class CloseableRegistry

java.lang.Object
  extended by org.marketcetera.util.file.CloseableRegistry
All Implemented Interfaces:
Closeable

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 Summary
CloseableRegistry()
           
 
Method Summary
 void close()
          Closes all Closeable instances registered with the receiver.
 void register(Closeable closeable)
          Registers a Closeable instance with the receiver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 Closeable


Copyright © 2012. All Rights Reserved.