Mercurial > hg > openjdk > bsd-port > jdk
changeset 7778:ce2dea6653e7
8003253: TEST_BUG: java/nio/channels/AsynchronousChannelGroup/Unbounded.java hang intermittently [win]
Reviewed-by: chegar
author | alanb |
---|---|
date | Sun, 11 Nov 2012 10:05:37 +0000 |
parents | 9e5c6b2fe171 |
children | ed39d094c281 |
files | test/java/nio/channels/AsynchronousChannelGroup/Unbounded.java |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/test/java/nio/channels/AsynchronousChannelGroup/Unbounded.java Tue Jan 21 07:53:24 2014 -0800 +++ b/test/java/nio/channels/AsynchronousChannelGroup/Unbounded.java Sun Nov 11 10:05:37 2012 +0000 @@ -36,6 +36,9 @@ // 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 @@ 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 void failed(Throwable exc, AsynchronousSocketChannel ch) { + failed = true; + System.err.println("read failed: " + exc); + completed(0, ch); } }); } @@ -104,6 +112,7 @@ while (remaining > 0) { AsynchronousSocketChannel ch = queue.take(); ch.write(ByteBuffer.wrap("welcome".getBytes())).get(); + ch.shutdownOutput(); ch.close(); remaining--; } @@ -112,5 +121,7 @@ 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"); } }