@ThreadSafe @Internal public class AutoCloseableRegistry extends AbstractAutoCloseableRegistry<AutoCloseable,AutoCloseable,Object,Exception>
AutoCloseable
, which are all closed if this
registry is closed.
Registering to an already closed registry will throw an exception and close the provided
AutoCloseable
.
Unlike CloseableRegistry
this class can throw an exception during the close.
This class closes all registered Closeable
s in the reverse registration order.
closeableToRef
Constructor and Description |
---|
AutoCloseableRegistry() |
Modifier and Type | Method and Description |
---|---|
protected void |
doClose(List<AutoCloseable> toClose)
This implementation implies that any exception is possible during closing.
|
protected void |
doRegister(AutoCloseable closeable,
Map<AutoCloseable,Object> closeableMap)
Does the actual registration of the closeable with the registry map.
|
protected boolean |
doUnRegister(AutoCloseable closeable,
Map<AutoCloseable,Object> closeableMap)
Does the actual un-registration of the closeable from the registry map.
|
close, getNumberOfRegisteredCloseables, getSynchronizationLock, isCloseableRegistered, isClosed, registerCloseable, removeCloseableInternal, unregisterCloseable
protected void doRegister(@Nonnull AutoCloseable closeable, @Nonnull Map<AutoCloseable,Object> closeableMap)
AbstractAutoCloseableRegistry
doRegister
in class AbstractAutoCloseableRegistry<AutoCloseable,AutoCloseable,Object,Exception>
protected boolean doUnRegister(@Nonnull AutoCloseable closeable, @Nonnull Map<AutoCloseable,Object> closeableMap)
AbstractAutoCloseableRegistry
doUnRegister
in class AbstractAutoCloseableRegistry<AutoCloseable,AutoCloseable,Object,Exception>
protected void doClose(List<AutoCloseable> toClose) throws Exception
doClose
in class AbstractAutoCloseableRegistry<AutoCloseable,AutoCloseable,Object,Exception>
Exception
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.