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, resultHandler
-
Fields inherited from class org.apache.flink.runtime.io.disk.iomanager.AbstractFileIOChannel
fileChannel, id, LOG
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AsynchronousBufferFileWriter(FileIOChannel.ID channelID, RequestQueue<org.apache.flink.runtime.io.disk.iomanager.WriteRequest> requestQueue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getNumberOfOutstandingRequests()
Returns the number of outstanding requests.boolean
registerAllRequestsProcessedListener(NotificationListener listener)
Registers a listener to be notified when all outstanding requests have been processed.void
writeBlock(Buffer buffer)
Writes the given block asynchronously.-
Methods inherited from class org.apache.flink.runtime.io.disk.iomanager.AsynchronousFileIOChannel
addRequest, checkErroneous, close, closeAndDelete, handleProcessedBuffer, isClosed
-
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.FileIOChannel
close, closeAndDelete, deleteChannel, getChannelID, getNioFileChannel, getSize, isClosed
-
-
-
-
Constructor Detail
-
AsynchronousBufferFileWriter
protected AsynchronousBufferFileWriter(FileIOChannel.ID channelID, RequestQueue<org.apache.flink.runtime.io.disk.iomanager.WriteRequest> requestQueue) throws IOException
- Throws:
IOException
-
-
Method Detail
-
writeBlock
public void writeBlock(Buffer buffer) throws IOException
Writes the given block asynchronously.- Specified by:
writeBlock
in 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:BufferFileWriter
Returns the number of outstanding requests.- Specified by:
getNumberOfOutstandingRequests
in interfaceBufferFileWriter
-
registerAllRequestsProcessedListener
public boolean registerAllRequestsProcessedListener(NotificationListener listener) throws IOException
Description copied from class:AsynchronousFileIOChannel
Registers 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:
registerAllRequestsProcessedListener
in interfaceBufferFileWriter
- Overrides:
registerAllRequestsProcessedListener
in classAsynchronousFileIOChannel<Buffer,org.apache.flink.runtime.io.disk.iomanager.WriteRequest>
- Throws:
IOException
-
-