Class AsynchronousBlockWriterWithCallback
- java.lang.Object
-
- org.apache.flink.runtime.io.disk.iomanager.AbstractFileIOChannel
-
- org.apache.flink.runtime.io.disk.iomanager.AsynchronousFileIOChannel<org.apache.flink.core.memory.MemorySegment,org.apache.flink.runtime.io.disk.iomanager.WriteRequest>
-
- org.apache.flink.runtime.io.disk.iomanager.AsynchronousBlockWriterWithCallback
-
- All Implemented Interfaces:
BlockChannelWriterWithCallback<org.apache.flink.core.memory.MemorySegment>,FileIOChannel
- Direct Known Subclasses:
AsynchronousBlockWriter
public class AsynchronousBlockWriterWithCallback extends AsynchronousFileIOChannel<org.apache.flink.core.memory.MemorySegment,org.apache.flink.runtime.io.disk.iomanager.WriteRequest> implements BlockChannelWriterWithCallback<org.apache.flink.core.memory.MemorySegment>
An asynchronous implementation of theBlockChannelWriterWithCallbackthat queues I/O requests and calls a callback once they have been handled.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.io.disk.iomanager.FileIOChannel
FileIOChannel.Enumerator, FileIOChannel.ID
-
-
Field Summary
-
Fields inherited from class org.apache.flink.runtime.io.disk.iomanager.AsynchronousFileIOChannel
closed, closeLock, exception, requestQueue, requestsNotReturned, resultHandler
-
Fields inherited from class org.apache.flink.runtime.io.disk.iomanager.AbstractFileIOChannel
fileChannel, id, LOG
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAsynchronousBlockWriterWithCallback(FileIOChannel.ID channelID, RequestQueue<org.apache.flink.runtime.io.disk.iomanager.WriteRequest> requestQueue, RequestDoneCallback<org.apache.flink.core.memory.MemorySegment> callback)Creates a new asynchronous block writer for the given channel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidwriteBlock(org.apache.flink.core.memory.MemorySegment segment)Issues a asynchronous write request to the writer.-
Methods inherited from class org.apache.flink.runtime.io.disk.iomanager.AsynchronousFileIOChannel
addRequest, checkErroneous, close, closeAndDelete, handleProcessedBuffer, isClosed, registerAllRequestsProcessedListener
-
Methods inherited from class org.apache.flink.runtime.io.disk.iomanager.AbstractFileIOChannel
deleteChannel, getChannelID, getNioFileChannel, getSize
-
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.runtime.io.disk.iomanager.FileIOChannel
close, closeAndDelete, deleteChannel, getChannelID, getNioFileChannel, getSize, isClosed
-
-
-
-
Constructor Detail
-
AsynchronousBlockWriterWithCallback
protected AsynchronousBlockWriterWithCallback(FileIOChannel.ID channelID, RequestQueue<org.apache.flink.runtime.io.disk.iomanager.WriteRequest> requestQueue, RequestDoneCallback<org.apache.flink.core.memory.MemorySegment> callback) throws IOException
Creates a new asynchronous block writer for the given channel.- Parameters:
channelID- The ID of the channel to write to.requestQueue- The request queue of the asynchronous writer thread, to which the I/O requests are added.callback- The callback to be invoked when requests are done.- Throws:
IOException- Thrown, if the underlying file channel could not be opened exclusively.
-
-
Method Detail
-
writeBlock
public void writeBlock(org.apache.flink.core.memory.MemorySegment segment) throws IOExceptionIssues a asynchronous write request to the writer.- Specified by:
writeBlockin interfaceBlockChannelWriterWithCallback<org.apache.flink.core.memory.MemorySegment>- Parameters:
segment- The segment to be written.- Throws:
IOException- Thrown, when the writer encounters an I/O error. Due to the asynchronous nature of the writer, the exception thrown here may have been caused by an earlier write request.
-
-