SmirAlex commented on code in PR #20919:
URL: https://github.com/apache/flink/pull/20919#discussion_r1041838205


##########
flink-table/flink-table-runtime/src/test/java/org/apache/flink/table/runtime/functions/table/fullcache/inputformat/InputFormatCacheLoaderTest.java:
##########
@@ -131,15 +133,19 @@ void testExceptionDuringReload() throws Exception {
     }
 
     @Test
-    void testCloseAndInterruptDuringReload() throws Exception {
-        AtomicInteger sleepCounter = new AtomicInteger(0);
-        int totalSleepCount = TestCacheLoader.DATA.size() + 1; // equals to 
number of all rows
+    void testInterruptDuringReload() throws Exception {
+        CountDownLatch recordsProcessingLatch = new CountDownLatch(1);
         Runnable reloadAction =
-                ThrowingRunnable.unchecked(
-                        () -> {
-                            sleepCounter.incrementAndGet();
-                            Thread.sleep(1000);
-                        });
+                () -> {
+                    try {
+                        // wait should be interrupted if everything works ok
+                        if (!recordsProcessingLatch.await(5, 
TimeUnit.SECONDS)) {
+                            throw new RuntimeException("timeout");
+                        }

Review Comment:
   Agree, I reused this code part in my latest commit with changed 
`CacheLoader#close`



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to