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, resultHandler
-
Fields inherited from class org.apache.flink.runtime.io.disk.iomanager.AbstractFileIOChannel
fileChannel, id, LOG
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAsynchronousBlockWriter(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.flink.core.memory.MemorySegmentgetNextReturnedBlock()Gets the next memory segment that has been written and is available again.LinkedBlockingQueue<org.apache.flink.core.memory.MemorySegment>getReturnQueue()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
writeBlock
-
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.BlockChannelWriterWithCallback
writeBlock
-
Methods inherited from interface org.apache.flink.runtime.io.disk.iomanager.FileIOChannel
close, closeAndDelete, deleteChannel, getChannelID, getNioFileChannel, getSize, isClosed
-
-
-
-
Constructor Detail
-
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 Detail
-
getNextReturnedBlock
public org.apache.flink.core.memory.MemorySegment getNextReturnedBlock() throws IOExceptionGets 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
public LinkedBlockingQueue<org.apache.flink.core.memory.MemorySegment> 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.
-
-