Package org.apache.flink.core.fs
Class CloseableRegistry
- java.lang.Object
-
- org.apache.flink.util.AbstractAutoCloseableRegistry<Closeable,Closeable,Object,IOException>
-
- org.apache.flink.core.fs.CloseableRegistry
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ICloseableRegistry
@Internal public class CloseableRegistry extends AbstractAutoCloseableRegistry<Closeable,Closeable,Object,IOException> implements ICloseableRegistry
ICloseableRegistry
implementation.
-
-
Field Summary
-
Fields inherited from class org.apache.flink.util.AbstractAutoCloseableRegistry
closeableToRef
-
Fields inherited from interface org.apache.flink.core.fs.ICloseableRegistry
NO_OP
-
-
Constructor Summary
Constructors Constructor Description CloseableRegistry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doClose(List<Closeable> toClose)
This implementation doesn't imply any exception during closing due to backward compatibility.protected void
doRegister(Closeable closeable, Map<Closeable,Object> closeableMap)
Does the actual registration of the closeable with the registry map.protected boolean
doUnRegister(Closeable closeable, Map<Closeable,Object> closeableMap)
Does the actual un-registration of the closeable from the registry map.void
unregisterAndCloseAll(Closeable... toUnregisterAndClose)
Unregisters all givenCloseable
objects from this registry and closes all objects that are were actually registered.-
Methods inherited from class org.apache.flink.util.AbstractAutoCloseableRegistry
close, getNumberOfRegisteredCloseables, getSynchronizationLock, isCloseableRegistered, isClosed, registerCloseable, removeCloseableInternal, unregisterCloseable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.core.fs.ICloseableRegistry
isClosed, registerCloseable, registerCloseableTemporarily, unregisterCloseable
-
-
-
-
Method Detail
-
doRegister
protected void doRegister(@Nonnull Closeable closeable, @Nonnull Map<Closeable,Object> closeableMap)
Description copied from class:AbstractAutoCloseableRegistry
Does the actual registration of the closeable with the registry map. This should not do any long running or potentially blocking operations as is is executed under the registry's lock.- Specified by:
doRegister
in classAbstractAutoCloseableRegistry<Closeable,Closeable,Object,IOException>
-
doUnRegister
protected boolean doUnRegister(@Nonnull Closeable closeable, @Nonnull Map<Closeable,Object> closeableMap)
Description copied from class:AbstractAutoCloseableRegistry
Does the actual un-registration of the closeable from the registry map. This should not do any long running or potentially blocking operations as is is executed under the registry's lock.- Specified by:
doUnRegister
in classAbstractAutoCloseableRegistry<Closeable,Closeable,Object,IOException>
-
doClose
public void doClose(List<Closeable> toClose) throws IOException
This implementation doesn't imply any exception during closing due to backward compatibility.- Specified by:
doClose
in classAbstractAutoCloseableRegistry<Closeable,Closeable,Object,IOException>
- Throws:
IOException
-
unregisterAndCloseAll
public void unregisterAndCloseAll(Closeable... toUnregisterAndClose) throws IOException
Unregisters all givenCloseable
objects from this registry and closes all objects that are were actually registered. Suppressed (and collects) all exceptions that happen during closing and throws only when the allCloseable
objects have been processed.- Parameters:
toUnregisterAndClose
- closables to unregister and close.- Throws:
IOException
- collects all exceptions encountered during closing of the given objects.
-
-