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.
  • 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

      public void writeBlock(org.apache.flink.core.memory.MemorySegment segment) throws IOException
      Issues a asynchronous write request to the writer.
      Specified by:
      writeBlock in interface BlockChannelWriterWithCallback<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.