Class AsynchronousBlockWriter
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
org.apache.flink.runtime.io.disk.iomanager.AsynchronousBlockWriter
- All Implemented Interfaces:
BlockChannelWriter<org.apache.flink.core.memory.MemorySegment>,BlockChannelWriterWithCallback<org.apache.flink.core.memory.MemorySegment>,FileIOChannel
public class AsynchronousBlockWriter
extends AsynchronousBlockWriterWithCallback
implements BlockChannelWriter<org.apache.flink.core.memory.MemorySegment>
-
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
ConstructorsModifierConstructorDescriptionprotectedAsynchronousBlockWriter(FileIOChannel.ID channelID, RequestQueue<org.apache.flink.runtime.io.disk.iomanager.WriteRequest> requestQueue, LinkedBlockingQueue<org.apache.flink.core.memory.MemorySegment> returnSegments) Creates a new block channel writer for the given channel. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.flink.core.memory.MemorySegmentGets the next memory segment that has been written and is available again.LinkedBlockingQueue<org.apache.flink.core.memory.MemorySegment>Gets the queue in which the memory segments are queued after the asynchronous write is completed.Methods inherited from class org.apache.flink.runtime.io.disk.iomanager.AsynchronousBlockWriterWithCallback
writeBlockMethods 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.BlockChannelWriterWithCallback
writeBlockMethods inherited from interface org.apache.flink.runtime.io.disk.iomanager.FileIOChannel
close, closeAndDelete, deleteChannel, getChannelID, getNioFileChannel, getSize, isClosed
-
Constructor Details
-
AsynchronousBlockWriter
protected AsynchronousBlockWriter(FileIOChannel.ID channelID, RequestQueue<org.apache.flink.runtime.io.disk.iomanager.WriteRequest> requestQueue, LinkedBlockingQueue<org.apache.flink.core.memory.MemorySegment> returnSegments) throws IOException Creates a new block channel 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.returnSegments- The return queue, to which the processed Memory Segments are added.- Throws:
IOException- Thrown, if the underlying file channel could not be opened exclusively.
-
-
Method Details
-
getNextReturnedBlock
Gets the next memory segment that has been written and is available again. This method blocks until such a segment is available, or until an error occurs in the writer, or the writer is closed.NOTE: If this method is invoked without any segment ever returning (for example, because the
AsynchronousBlockWriterWithCallback.writeBlock(MemorySegment)method has not been invoked accordingly), the method may block forever.- Specified by:
getNextReturnedBlockin interfaceBlockChannelWriter<org.apache.flink.core.memory.MemorySegment>- Returns:
- The next memory segment from the writers's return queue.
- Throws:
IOException- Thrown, if an I/O error occurs in the writer while waiting for the request to return.
-
getReturnQueue
Gets the queue in which the memory segments are queued after the asynchronous write is completed.- Specified by:
getReturnQueuein interfaceBlockChannelWriter<org.apache.flink.core.memory.MemorySegment>- Returns:
- The queue with the written memory segments.
-