Github user pnowojski commented on a diff in the pull request:
https://github.com/apache/flink/pull/4581#discussion_r152918616
--- Diff:
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/SpillableSubpartitionTest.java
---
@@ -320,4 +559,40 @@ void awaitNotifications(long
awaitedNumNotifiedBuffers, long timeoutMillis) thro
}
}
}
+
+ /**
+ * An {@link IOManagerAsync} that creates closed {@link
BufferFileWriter} instances in its
+ * {@link #createBufferFileWriter(FileIOChannel.ID)} method.
+ *
+ * <p>These {@link BufferFileWriter} objects will thus throw an
exception when trying to add
+ * write requests, e.g. by calling {@link
BufferFileWriter#writeBlock(Object)}.
+ */
+ private static class IOManagerAsyncWithClosedBufferFileWriter extends
IOManagerAsync {
+ @Override
+ public BufferFileWriter createBufferFileWriter(FileIOChannel.ID
channelID)
+ throws IOException {
+ BufferFileWriter bufferFileWriter =
super.createBufferFileWriter(channelID);
+ bufferFileWriter.close();
+ return bufferFileWriter;
+ }
+ }
+
+ /**
+ * An {@link IOManagerAsync} that creates stalling {@link
BufferFileWriter} instances in its
+ * {@link #createBufferFileWriter(FileIOChannel.ID)} method.
+ *
+ * <p>These {@link BufferFileWriter} objects will accept {@link
BufferFileWriter#writeBlock(Object)}
+ * requests but never actually perform any write operation (be sure to
clean up the buffers
+ * manually!).
+ */
+ private static class IOManagerAsyncWithStallingBufferFileWriter extends
IOManagerAsync {
+ @Override
+ public BufferFileWriter createBufferFileWriter(FileIOChannel.ID
channelID)
+ throws IOException {
+ BufferFileWriter bufferFileWriter =
spy(super.createBufferFileWriter(channelID));
--- End diff --
:/ and with every such case we increase the costs of refactors. I would
still extract those classes to the correct package.
---