public class AsynchronousBufferFileWriter extends AsynchronousFileIOChannel<Buffer,org.apache.flink.runtime.io.disk.iomanager.WriteRequest> implements BufferFileWriter
FileIOChannel.Enumerator, FileIOChannel.ID
closed, closeLock, exception, requestQueue, requestsNotReturned, resultHandler
fileChannel, id, LOG
Modifier | Constructor and Description |
---|---|
protected |
AsynchronousBufferFileWriter(FileIOChannel.ID channelID,
RequestQueue<org.apache.flink.runtime.io.disk.iomanager.WriteRequest> requestQueue) |
Modifier and Type | Method and 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.
|
addRequest, checkErroneous, close, closeAndDelete, handleProcessedBuffer, isClosed
deleteChannel, getChannelID, getNioFileChannel, getSize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, closeAndDelete, deleteChannel, getChannelID, getNioFileChannel, getSize, isClosed
protected AsynchronousBufferFileWriter(FileIOChannel.ID channelID, RequestQueue<org.apache.flink.runtime.io.disk.iomanager.WriteRequest> requestQueue) throws IOException
IOException
public void writeBlock(Buffer buffer) throws IOException
writeBlock
in interface BlockChannelWriterWithCallback<Buffer>
buffer
- the buffer to be written (will be recycled when done)IOException
- thrown if adding the write operation failspublic int getNumberOfOutstandingRequests()
BufferFileWriter
getNumberOfOutstandingRequests
in interface BufferFileWriter
public boolean registerAllRequestsProcessedListener(NotificationListener listener) throws IOException
AsynchronousFileIOChannel
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.
registerAllRequestsProcessedListener
in interface BufferFileWriter
registerAllRequestsProcessedListener
in class AsynchronousFileIOChannel<Buffer,org.apache.flink.runtime.io.disk.iomanager.WriteRequest>
IOException
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.