StefanRRichter commented on a change in pull request #7273: [FLINK-11122][core] 
Change signature of WrappingProxyUtil#stripProxy(T)
URL: https://github.com/apache/flink/pull/7273#discussion_r240955517
 
 

 ##########
 File path: 
flink-core/src/test/java/org/apache/flink/core/fs/AbstractCloseableRegistryTest.java
 ##########
 @@ -225,4 +209,55 @@ public synchronized void close() throws IOException {
                        refCount.decrementAndGet();
                }
        }
+
+       /**
+        * A noop {@link Closeable} implementation that blocks inside {@link 
#close()}.
+        */
+       private static class BlockingTestCloseable implements Closeable {
+
+               private final CountDownLatch closeCalledLatch = new 
CountDownLatch(1);
+
+               private final CountDownLatch blockCloseLatch = new 
CountDownLatch(1);
+
+               @Override
+               public void close() throws IOException {
+                       closeCalledLatch.countDown();
+                       try {
+                               blockCloseLatch.await();
+                       } catch (InterruptedException e) {
+                               Thread.currentThread().interrupt();
+                       }
+               }
+
+               /**
+                * Unblocks {@link #close()}.
+                */
+               public void unblockClose() {
+                       blockCloseLatch.countDown();
+               }
+
+               /**
+                * Causes the current thread to wait until {@link #close()} is 
called.
+                */
+               public void awaitClose(final long timeout, final TimeUnit 
timeUnit) throws InterruptedException {
+                       closeCalledLatch.await(timeout, timeUnit);
+               }
+       }
+
+       /**
+        * A noop {@link Closeable} implementation that tracks whether it was 
closed.
+        */
+       private static class TestCloseable implements Closeable {
+
+               private final AtomicBoolean closed = new AtomicBoolean();
+
+               @Override
+               public void close() throws IOException {
+                       closed.set(true);
 
 Review comment:
   We could make the test a bit stricter by ensuring compareAndSet(false, true) 
to check that close should also be called only once. A small improvent that 
would be cheap to do.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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

Reply via email to