Clarkkkkk commented on a change in pull request #7780: [FLINK-11593][tests]
Check & port TaskManagerTest to new code base
URL: https://github.com/apache/flink/pull/7780#discussion_r268018759
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/TestingAbstractInvokables.java
##########
@@ -82,4 +84,51 @@ public void invoke() throws Exception {
}
}
}
+
+ public static final class TestInvokableRecordCancel extends
AbstractInvokable {
+
+ private static final Object lock = new Object();
+ private static CompletableFuture<Boolean> gotCanceledFuture =
new CompletableFuture<>();
+
+ public TestInvokableRecordCancel(Environment environment) {
+ super(environment);
+ }
+
+ @Override
+ public void invoke() throws Exception {
+ final Object o = new Object();
+ RecordWriter<IntValue> recordWriter = new
RecordWriter<>(getEnvironment().getWriter(0));
+
+ for (int i = 0; i < 1024; i++) {
+ recordWriter.emit(new IntValue(42));
+ }
+
+ synchronized (o) {
+ //noinspection InfiniteLoopStatement
+ while (true) {
+ o.wait();
+ }
+ }
+
+ }
+
+ @Override
+ public void cancel() {
+ synchronized (lock) {
Review comment:
You are right.
----------------------------------------------------------------
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