public class AsynchronousBufferFileWriter extends AsynchronousFileIOChannel<Buffer,org.apache.flink.runtime.io.disk.iomanager.WriteRequest> implements BufferFileWriter
FileIOChannel.Enumerator, FileIOChannel.IDclosed, closeLock, exception, requestQueue, requestsNotReturned, resultHandlerfileChannel, 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, isCloseddeleteChannel, getChannelID, getNioFileChannel, getSizeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, closeAndDelete, deleteChannel, getChannelID, getNioFileChannel, getSize, isClosedprotected AsynchronousBufferFileWriter(FileIOChannel.ID channelID, RequestQueue<org.apache.flink.runtime.io.disk.iomanager.WriteRequest> requestQueue) throws IOException
IOExceptionpublic 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()
BufferFileWritergetNumberOfOutstandingRequests in interface BufferFileWriterpublic boolean registerAllRequestsProcessedListener(NotificationListener listener) throws IOException
AsynchronousFileIOChannelNew 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 BufferFileWriterregisterAllRequestsProcessedListener in class AsynchronousFileIOChannel<Buffer,org.apache.flink.runtime.io.disk.iomanager.WriteRequest>IOExceptionCopyright © 2014–2023 The Apache Software Foundation. All rights reserved.