Class FsCheckpointMetadataOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.flink.core.fs.FSDataOutputStream
-
- org.apache.flink.runtime.state.CheckpointMetadataOutputStream
-
- org.apache.flink.runtime.state.filesystem.FsCheckpointMetadataOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public final class FsCheckpointMetadataOutputStream extends CheckpointMetadataOutputStream
ACheckpointMetadataOutputStream
that writes a specified file and directory, and returns aFsCompletedCheckpointStorageLocation
upon closing.
-
-
Constructor Summary
Constructors Constructor Description FsCheckpointMetadataOutputStream(org.apache.flink.core.fs.FileSystem fileSystem, org.apache.flink.core.fs.Path metadataFilePath, org.apache.flink.core.fs.Path exclusiveCheckpointDir)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
This method should close the stream, if has not been closed before.FsCompletedCheckpointStorageLocation
closeAndFinalizeCheckpoint()
Closes the stream after all metadata was written and finalizes the checkpoint location.void
flush()
long
getPos()
boolean
isClosed()
void
sync()
void
write(byte[] b, int off, int len)
void
write(int b)
-
Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
-
-
-
Constructor Detail
-
FsCheckpointMetadataOutputStream
public FsCheckpointMetadataOutputStream(org.apache.flink.core.fs.FileSystem fileSystem, org.apache.flink.core.fs.Path metadataFilePath, org.apache.flink.core.fs.Path exclusiveCheckpointDir) throws IOException
- Throws:
IOException
-
-
Method Detail
-
write
public final void write(int b) throws IOException
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
public final void write(@Nonnull byte[] b, int off, int len) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
getPos
public long getPos() throws IOException
- Specified by:
getPos
in classorg.apache.flink.core.fs.FSDataOutputStream
- Throws:
IOException
-
flush
public void flush() throws IOException
- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in classorg.apache.flink.core.fs.FSDataOutputStream
- Throws:
IOException
-
sync
public void sync() throws IOException
- Specified by:
sync
in classorg.apache.flink.core.fs.FSDataOutputStream
- Throws:
IOException
-
isClosed
public boolean isClosed()
-
close
public void close()
Description copied from class:CheckpointMetadataOutputStream
This method should close the stream, if has not been closed before. If this method actually closes the stream, it should delete/release the resource behind the stream, such as the file that the stream writes to.The above implies that this method is intended to be the "unsuccessful close", such as when cancelling the stream writing, or when an exception occurs. Closing the stream for the successful case must go through
CheckpointMetadataOutputStream.closeAndFinalizeCheckpoint()
.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classCheckpointMetadataOutputStream
-
closeAndFinalizeCheckpoint
public FsCompletedCheckpointStorageLocation closeAndFinalizeCheckpoint() throws IOException
Description copied from class:CheckpointMetadataOutputStream
Closes the stream after all metadata was written and finalizes the checkpoint location.- Specified by:
closeAndFinalizeCheckpoint
in classCheckpointMetadataOutputStream
- Returns:
- An object representing a finalized checkpoint storage location.
- Throws:
IOException
- Thrown, if the stream cannot be closed or the finalization fails.
-
-