# HG changeset patch # User amlu # Date 1460440428 -28800 # Node ID eb17ca049605d6b39a9675d2ff8da59b2f57f8a9 # Parent 645dd89cd76cb9b82bab5636714e232f896acc0b 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 diff -r 645dd89cd76c -r eb17ca049605 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 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);