changeset 51751:9baa91bc7567

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
author xiaofeya
date Fri, 13 Jul 2018 11:21:55 +0800
parents 7c96d1e40280
children fc6cfe40e32a
files test/jdk/java/nio/channels/Selector/RegisterDuringSelect.java
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
 
     }
 }
+