zhijiangW commented on a change in pull request #10375: [FLINK-14845][runtime]
Introduce data compression to reduce disk and network IO of shuffle.
URL: https://github.com/apache/flink/pull/10375#discussion_r353700890
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/consumer/SingleInputGateTest.java
##########
@@ -700,4 +725,39 @@ static void verifyBufferOrEvent(
assertFalse(inputGate.pollNext().isPresent());
}
}
+
+ /**
+ * A testing implementation of {@link ResultPartitionManager} which
counts the number of
+ * {@link ResultSubpartitionView} created.
+ */
+ public static class TestingResultPartitionManager extends
ResultPartitionManager {
+ private int counter = 0;
+ private final ResultSubpartitionView subpartitionView;
+
+ public TestingResultPartitionManager(ResultSubpartitionView
subpartitionView) {
+ this.subpartitionView = subpartitionView;
+ }
+
+ @Override
+ public synchronized ResultSubpartitionView
createSubpartitionView(
+ ResultPartitionID partitionId,
+ int subpartitionIndex,
+ BufferAvailabilityListener
availabilityListener) throws IOException {
+ ++counter;
+ return subpartitionView;
+ }
+ }
+
+ /**
+ * A testing implementation of {@link TaskEventPublisher} which counts
the number of publish times.
+ */
+ private static class TestingTaskEventPublisher implements
TaskEventPublisher {
+ private int counter = 0;
+
+ @Override
+ public synchronized boolean publish(ResultPartitionID
partitionId, TaskEvent event) {
Review comment:
ditto: no `synchronized` needed for tests.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services