C - Type of the closeable this registersT - Type for potential meta data associated with the registering closeables@Internal public abstract class AbstractCloseableRegistry<C extends Closeable,T> extends Object implements Closeable
| Modifier and Type | Field and Description |
|---|---|
protected Map<Closeable,T> |
closeableToRef |
| Constructor and Description |
|---|
AbstractCloseableRegistry(Map<Closeable,T> closeableToRef) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected abstract void |
doRegister(C closeable,
Map<Closeable,T> closeableMap) |
protected abstract void |
doUnRegister(C closeable,
Map<Closeable,T> closeableMap) |
protected Object |
getSynchronizationLock() |
boolean |
isClosed() |
void |
registerClosable(C closeable)
Registers a
Closeable with the registry. |
void |
unregisterClosable(C closeable)
Removes a
Closeable from the registry. |
public final void registerClosable(C closeable) throws IOException
Closeable with the registry. In case the registry is already closed, this method throws an
IllegalStateException and closes the passed Closeable.closeable - Closeable tor registerIOException - exception when the registry was closed beforepublic final void unregisterClosable(C closeable)
Closeable from the registry.closeable - instance to remove from the registry.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic boolean isClosed()
protected final Object getSynchronizationLock()
protected abstract void doRegister(C closeable, Map<Closeable,T> closeableMap) throws IOException
IOExceptionCopyright © 2014–2017 The Apache Software Foundation. All rights reserved.