8068693: (ch) test java/nio/channels/AsyncCloseAndInterrupt.java failing.
authoramlu
Tue, 12 Apr 2016 13:53:48 +0800
changeset 37307 eb17ca049605
parent 37306 645dd89cd76c
child 37308 4c4141aac146
8068693: (ch) test java/nio/channels/AsyncCloseAndInterrupt.java failing. 8153209: java/nio/channels/AsyncCloseAndInterrupt.java fails throwing exception: java.nio.channels.ClosedChannelException. Summary: for JDK-8068693, 500ms is too short on busy system for channel to be closed or for thread blocking on IO to be interrupted, increase the time from 500ms to 10000ms. for JDK-8153209, it's a test regression due to JDK-8151582, do not sleep when running tests for CONNECT/FINISH_CONNECT, sleep for other test cases. Reviewed-by: bpb, martin, rriggs Contributed-by: Hamlin Li <huaming.li@oracle.com>
jdk/test/java/nio/channels/AsyncCloseAndInterrupt.java
--- a/jdk/test/java/nio/channels/AsyncCloseAndInterrupt.java	Tue Apr 12 09:54:55 2016 +0800
+++ b/jdk/test/java/nio/channels/AsyncCloseAndInterrupt.java	Tue Apr 12 13:53:48 2016 +0800
@@ -23,7 +23,7 @@
 
 /* @test
  * @bug 4460583 4470470 4840199 6419424 6710579 6596323 6824135 6395224 7142919
- *      8151582
+ *      8151582 8068693 8153209
  * @run main/othervm AsyncCloseAndInterrupt
  * @summary Comprehensive test of asynchronous closing and interruption
  * @author Mark Reinhold
@@ -557,7 +557,11 @@
     }
 
     // Test
-    static void test(ChannelFactory cf, Op op, int test)
+    static void test(ChannelFactory cf, Op op, int test) throws Exception {
+        test(cf, op, test, true);
+    }
+
+    static void test(ChannelFactory cf, Op op, int test, boolean extraSleep)
         throws Exception
     {
         log.println();
@@ -571,6 +575,10 @@
             sleep(50);
         } while (!t.ready);
 
+        if (extraSleep) {
+            sleep(100);
+        }
+
         switch (test) {
 
         case TEST_INTR:
@@ -603,15 +611,18 @@
             break;
         }
 
-        t.finishAndThrow(500);
+        t.finishAndThrow(10000);
     }
 
-
     static void test(ChannelFactory cf, Op op) throws Exception {
+        test(cf, op, true);
+    }
+
+    static void test(ChannelFactory cf, Op op, boolean extraSleep) throws Exception {
         // Test INTR cases before PREINTER cases since sometimes
         // interrupted threads can't load classes
-        test(cf, op, TEST_INTR);
-        test(cf, op, TEST_PREINTR);
+        test(cf, op, TEST_INTR, extraSleep);
+        test(cf, op, TEST_PREINTR, extraSleep);
 
         // Bugs, see FileChannelImpl for details
         if (op == TRANSFER_FROM) {
@@ -623,7 +634,7 @@
             return;
         }
 
-        test(cf, op, TEST_CLOSE);
+        test(cf, op, TEST_CLOSE, extraSleep);
     }
 
     static void test(ChannelFactory cf)
@@ -720,8 +731,8 @@
                 Future<Integer> pumpFuture = pumpRefuser(pumperExecutor);
                 waitPump("\nWait for initial Pump");
 
-                test(socketChannelFactory, CONNECT);
-                test(socketChannelFactory, FINISH_CONNECT);
+                test(socketChannelFactory, CONNECT, false);
+                test(socketChannelFactory, FINISH_CONNECT, false);
 
                 pumpDone = true;
                 Integer newConn = pumpFuture.get(30, TimeUnit.SECONDS);