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
ICloseableRegistryimplementation.
-
-
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 voiddoClose(List<Closeable> toClose)This implementation doesn't imply any exception during closing due to backward compatibility.protected voiddoRegister(Closeable closeable, Map<Closeable,Object> closeableMap)Does the actual registration of the closeable with the registry map.protected booleandoUnRegister(Closeable closeable, Map<Closeable,Object> closeableMap)Does the actual un-registration of the closeable from the registry map.voidunregisterAndCloseAll(Closeable... toUnregisterAndClose)Unregisters all givenCloseableobjects 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:AbstractAutoCloseableRegistryDoes the actual registration of the closeable with the registry map. This should not do any long running or potentially blocking operations as it is executed under the registry's lock.- Specified by:
doRegisterin classAbstractAutoCloseableRegistry<Closeable,Closeable,Object,IOException>
-
doUnRegister
protected boolean doUnRegister(@Nonnull Closeable closeable, @Nonnull Map<Closeable,Object> closeableMap)Description copied from class:AbstractAutoCloseableRegistryDoes the actual un-registration of the closeable from the registry map. This should not do any long running or potentially blocking operations as it is executed under the registry's lock.- Specified by:
doUnRegisterin 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:
doClosein classAbstractAutoCloseableRegistry<Closeable,Closeable,Object,IOException>- Throws:
IOException
-
unregisterAndCloseAll
public void unregisterAndCloseAll(Closeable... toUnregisterAndClose) throws IOException
Unregisters all givenCloseableobjects 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 allCloseableobjects have been processed.- Parameters:
toUnregisterAndClose- closables to unregister and close.- Throws:
IOException- collects all exceptions encountered during closing of the given objects.
-
-