8202481: RegisterDuringSelect.java fails with java.util.concurrent.ExecutionException: java.nio.channels.ClosedSelectorException
authorxiaofeya
Fri, 13 Jul 2018 11:21:55 +0800
changeset 51077 9baa91bc7567
parent 51076 7c96d1e40280
child 51078 fc6cfe40e32a
8202481: RegisterDuringSelect.java fails with java.util.concurrent.ExecutionException: java.nio.channels.ClosedSelectorException 8207023: Add trace info to java/nio/channels/Selector/RegisterDuringSelect.java Reviewed-by: alanb
test/jdk/java/nio/channels/Selector/RegisterDuringSelect.java
--- 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 @@
 
     }
 }
+