Class AsynchronousBufferFileWriter
java.lang.Object
org.apache.flink.runtime.io.disk.iomanager.AbstractFileIOChannel
org.apache.flink.runtime.io.disk.iomanager.AsynchronousFileIOChannel<Buffer,org.apache.flink.runtime.io.disk.iomanager.WriteRequest>
org.apache.flink.runtime.io.disk.iomanager.AsynchronousBufferFileWriter
- All Implemented Interfaces:
BlockChannelWriterWithCallback<Buffer>,BufferFileWriter,FileIOChannel
public class AsynchronousBufferFileWriter
extends AsynchronousFileIOChannel<Buffer,org.apache.flink.runtime.io.disk.iomanager.WriteRequest>
implements BufferFileWriter
-
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
ConstructorsModifierConstructorDescriptionprotectedAsynchronousBufferFileWriter(FileIOChannel.ID channelID, RequestQueue<org.apache.flink.runtime.io.disk.iomanager.WriteRequest> requestQueue) -
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of outstanding requests.booleanRegisters a listener to be notified when all outstanding requests have been processed.voidwriteBlock(Buffer buffer) Writes the given block asynchronously.Methods inherited from class org.apache.flink.runtime.io.disk.iomanager.AsynchronousFileIOChannel
addRequest, checkErroneous, close, closeAndDelete, handleProcessedBuffer, isClosedMethods 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
-
AsynchronousBufferFileWriter
protected AsynchronousBufferFileWriter(FileIOChannel.ID channelID, RequestQueue<org.apache.flink.runtime.io.disk.iomanager.WriteRequest> requestQueue) throws IOException - Throws:
IOException
-
-
Method Details
-
writeBlock
Writes the given block asynchronously.- Specified by:
writeBlockin interfaceBlockChannelWriterWithCallback<Buffer>- Parameters:
buffer- the buffer to be written (will be recycled when done)- Throws:
IOException- thrown if adding the write operation fails
-
getNumberOfOutstandingRequests
public int getNumberOfOutstandingRequests()Description copied from interface:BufferFileWriterReturns the number of outstanding requests.- Specified by:
getNumberOfOutstandingRequestsin interfaceBufferFileWriter
-
registerAllRequestsProcessedListener
public boolean registerAllRequestsProcessedListener(NotificationListener listener) throws IOException Description copied from class:AsynchronousFileIOChannelRegisters a listener to be notified when all outstanding requests have been processed.New requests can arrive right after the listener got notified. Therefore, it is not safe to assume that the number of outstanding requests is still zero after a notification unless there was a close right before the listener got called.
Returns
true, if the registration was successful. A registration can fail, if there are no outstanding requests when trying to register a listener.- Specified by:
registerAllRequestsProcessedListenerin interfaceBufferFileWriter- Overrides:
registerAllRequestsProcessedListenerin classAsynchronousFileIOChannel<Buffer,org.apache.flink.runtime.io.disk.iomanager.WriteRequest> - Throws:
IOException
-