Class WrapperAsyncFSOutput
java.lang.Object
org.apache.hadoop.hbase.io.asyncfs.WrapperAsyncFSOutput
- All Implemented Interfaces:
Closeable,AutoCloseable,AsyncFSOutput
An
AsyncFSOutput wraps a FSDataOutputStream.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ByteArrayOutputStreamprivate final ExecutorServiceprivate final org.apache.hadoop.fs.FSDataOutputStreamprivate long -
Constructor Summary
ConstructorsConstructorDescriptionWrapperAsyncFSOutput(org.apache.hadoop.fs.Path file, org.apache.hadoop.fs.FSDataOutputStream out) -
Method Summary
Modifier and TypeMethodDescriptionintbuffered()Return the current size of buffered data.voidclose()Close the file.flush(boolean sync) Flush the buffer out.private voidflush0(CompletableFuture<Long> future, ByteArrayOutputStream buffer, boolean sync) org.apache.hadoop.hdfs.protocol.DatanodeInfo[]Return current pipeline.longReturns byteSize success synced to underlying filesystem.booleanisBroken()Whether the stream is broken.voidrecoverAndClose(CancelableProgressable reporter) The close method when error occurred.voidwrite(byte[] b) Just call write(b, 0, b.length).voidwrite(byte[] b, int off, int len) Copy the data into the buffer.voidwrite(ByteBuffer bb) Copy the data in the givenbbinto the buffer.voidwriteInt(int i) Write an int to the buffer.
-
Field Details
-
out
-
buffer
-
executor
-
syncedLength
-
-
Constructor Details
-
WrapperAsyncFSOutput
public WrapperAsyncFSOutput(org.apache.hadoop.fs.Path file, org.apache.hadoop.fs.FSDataOutputStream out)
-
-
Method Details
-
write
Description copied from interface:AsyncFSOutputJust call write(b, 0, b.length).- Specified by:
writein interfaceAsyncFSOutput- See Also:
-
write
Description copied from interface:AsyncFSOutputCopy the data into the buffer. Note that you need to callAsyncFSOutput.flush(boolean)to flush the buffer manually.- Specified by:
writein interfaceAsyncFSOutput
-
writeInt
Description copied from interface:AsyncFSOutputWrite an int to the buffer.- Specified by:
writeIntin interfaceAsyncFSOutput
-
write
Description copied from interface:AsyncFSOutputCopy the data in the givenbbinto the buffer.- Specified by:
writein interfaceAsyncFSOutput
-
buffered
Description copied from interface:AsyncFSOutputReturn the current size of buffered data.- Specified by:
bufferedin interfaceAsyncFSOutput
-
getPipeline
Description copied from interface:AsyncFSOutputReturn current pipeline. Empty array if no pipeline.- Specified by:
getPipelinein interfaceAsyncFSOutput
-
flush0
-
flush
Description copied from interface:AsyncFSOutputFlush the buffer out.- Specified by:
flushin interfaceAsyncFSOutput- Parameters:
sync- persistent the data to device- Returns:
- A CompletableFuture that hold the acked length after flushing.
-
recoverAndClose
Description copied from interface:AsyncFSOutputThe close method when error occurred.- Specified by:
recoverAndClosein interfaceAsyncFSOutput- Throws:
IOException
-
close
Description copied from interface:AsyncFSOutputClose the file. You should callAsyncFSOutput.recoverAndClose(CancelableProgressable)if this method throws an exception.- Specified by:
closein interfaceAsyncFSOutput- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
isBroken
Description copied from interface:AsyncFSOutputWhether the stream is broken.- Specified by:
isBrokenin interfaceAsyncFSOutput
-
getSyncedLength
Description copied from interface:AsyncFSOutputReturns byteSize success synced to underlying filesystem.- Specified by:
getSyncedLengthin interfaceAsyncFSOutput
-