diff options
author | alanb <none@none> | 2012-11-11 10:05:37 +0000 |
---|---|---|
committer | alanb <none@none> | 2012-11-11 10:05:37 +0000 |
commit | d775f059ca76f84d530bb3b423ca6118f1be6bb8 (patch) | |
tree | 0e5a2d7f569f6d6c3f629ec22d66a4c40ce7e8f8 /test/java/nio/channels | |
parent | 481c3911266176548c7387396112ec8382a6272d (diff) |
8003253: TEST_BUG: java/nio/channels/AsynchronousChannelGroup/Unbounded.java hang intermittently [win]
Reviewed-by: chegar
Diffstat (limited to 'test/java/nio/channels')
-rw-r--r-- | test/java/nio/channels/AsynchronousChannelGroup/Unbounded.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/java/nio/channels/AsynchronousChannelGroup/Unbounded.java b/test/java/nio/channels/AsynchronousChannelGroup/Unbounded.java index 0ca96fbbb..6e764a2b6 100644 --- a/test/java/nio/channels/AsynchronousChannelGroup/Unbounded.java +++ b/test/java/nio/channels/AsynchronousChannelGroup/Unbounded.java @@ -36,6 +36,9 @@ public class Unbounded { // number of concurrent completion handlers static final int CONCURRENCY_COUNT = 256; + // set to true if an I/O operation fails + static volatile boolean failed; + public static void main(String[] args) throws Exception { // all accepted connections are added to a queue final ArrayBlockingQueue<AsynchronousSocketChannel> queue = @@ -51,6 +54,8 @@ public class Unbounded { listener.accept((Void)null, this); } public void failed(Throwable exc, Void att) { + failed = true; + System.err.println("accept failed: " + exc); } }); System.out.println("Listener created."); @@ -94,6 +99,9 @@ public class Unbounded { } } public void failed(Throwable exc, AsynchronousSocketChannel ch) { + failed = true; + System.err.println("read failed: " + exc); + completed(0, ch); } }); } @@ -104,6 +112,7 @@ public class Unbounded { while (remaining > 0) { AsynchronousSocketChannel ch = queue.take(); ch.write(ByteBuffer.wrap("welcome".getBytes())).get(); + ch.shutdownOutput(); ch.close(); remaining--; } @@ -112,5 +121,7 @@ public class Unbounded { System.out.println("Waiting for all threads to reach barrier"); barrier.await(); listener.close(); + if (failed) + throw new RuntimeException("I/O failed failed, see log for details"); } } |