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 the
BlockChannelWriterWithCallback that 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, resultHandlerFields inherited from class org.apache.flink.runtime.io.disk.iomanager.AbstractFileIOChannel
fileChannel, id, LOG -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAsynchronousBlockWriterWithCallback(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
Modifier and TypeMethodDescriptionvoidwriteBlock(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, registerAllRequestsProcessedListenerMethods inherited from class org.apache.flink.runtime.io.disk.iomanager.AbstractFileIOChannel
deleteChannel, getChannelID, getNioFileChannel, getSizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.flink.runtime.io.disk.iomanager.FileIOChannel
close, closeAndDelete, deleteChannel, getChannelID, getNioFileChannel, getSize, isClosed
-
Constructor Details
-
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 Details
-
writeBlock
Issues 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.
-