@Internal public abstract class CheckpointStateOutputStream extends FSDataOutputStream
Important: When closing this stream after the successful case, you must call
closeAndGetHandle() - only that method will actually retain the resource written to. The method
has the semantics of "close on success". The
close() method is supposed to remove the
target resource if called before
closeAndGetHandle(), hence having the semantics of
"close on failure". That way, simple try-with-resources statements automatically clean up
unsuccessful partial state resources in case the writing does not complete.
Note: This is an abstract class and not an interface because
OutputStream is an
|Constructor and Description|
|Modifier and Type||Method and Description|
This method should close the stream, if has not been closed before.
Closes the stream and gets a state handle that can create an input stream producing the data written to this stream.
@Nullable public abstract StreamStateHandle closeAndGetHandle() throws IOException
This closing must be called (also when the caller is not interested in the handle) to
successfully close the stream and retain the produced resource. In contrast, the
close() method removes the target resource when called.
IOException- Thrown, if the stream cannot be closed.
public abstract void close() throws IOException
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
Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.