test/jdk/java/nio/channels/Selector/RegisterDuringSelect.java
changeset 51077 9baa91bc7567
parent 49802 8ac08fa69f00
child 51602 dbb0e798deeb
--- a/test/jdk/java/nio/channels/Selector/RegisterDuringSelect.java	Thu Jul 12 17:32:37 2018 -0700
+++ b/test/jdk/java/nio/channels/Selector/RegisterDuringSelect.java	Fri Jul 13 11:21:55 2018 +0800
@@ -28,6 +28,7 @@
  */
 
 import java.io.IOException;
+import java.nio.channels.ClosedSelectorException;
 import java.nio.channels.Pipe;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
@@ -44,9 +45,14 @@
             @Override
             public Void call() throws IOException {
                 for (;;) {
-                    sel.select();
+                    try {
+                        sel.select();
+                    } catch (ClosedSelectorException ignore) {
+                        return null;
+                    }
                     if (sel.isOpen()) {
                         barrier.arriveAndAwaitAdvance();
+                        System.out.println("selectLoop advanced ...");
                     } else {
                         // closed
                         return null;
@@ -107,3 +113,4 @@
 
     }
 }
+