1996fanrui commented on code in PR #21304:
URL: https://github.com/apache/flink/pull/21304#discussion_r1021261838


##########
flink-rpc/flink-rpc-akka/src/test/java/org/apache/flink/runtime/rpc/akka/ContextClassLoadingSettingTest.java:
##########
@@ -150,21 +154,28 @@ void 
testAkkaRpcService_ScheduleRunnableSetsFlinkContextClassLoader()
     void 
testAkkaRpcService_ScheduleRunnableWithFixedRateSetsFlinkContextClassLoader() {
         final int numberOfScheduledRuns = 2;
         final List<ClassLoader> contextClassLoaders = new 
ArrayList<>(numberOfScheduledRuns);
-        akkaRpcService
-                .getScheduledExecutor()
-                .scheduleAtFixedRate(
-                        () -> {
-                            if (contextClassLoaders.size() < 
numberOfScheduledRuns) {
-                                contextClassLoaders.add(
-                                        
Thread.currentThread().getContextClassLoader());
-                            } else {
-                                throw new RuntimeException("cancel task");
-                            }
-                        },
-                        0,
-                        1,
-                        TimeUnit.MILLISECONDS);
-
+        ScheduledFuture<?> future =
+                akkaRpcService
+                        .getScheduledExecutor()
+                        .scheduleAtFixedRate(
+                                () -> {
+                                    if (contextClassLoaders.size() < 
numberOfScheduledRuns) {
+                                        contextClassLoaders.add(
+                                                
Thread.currentThread().getContextClassLoader());
+                                    } else {
+                                        throw new RuntimeException("cancel 
task");
+                                    }
+                                },
+                                0,
+                                1,
+                                TimeUnit.MILLISECONDS);
+        try {
+            future.get();
+            fail("The future should fail.");

Review Comment:
   Hi @zentol , Thanks for your review, I updated.



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to