8003285: TEST_BUG: java/nio/channels/AsynchronousChannelGroup/Unbounded.java fails again [macosx]
Reviewed-by: chegar
This commit is contained in:
parent
6bb3dd6ea2
commit
8c308db579
@ -39,6 +39,9 @@ public class Unbounded {
|
|||||||
// set to true if an I/O operation fails
|
// set to true if an I/O operation fails
|
||||||
static volatile boolean failed;
|
static volatile boolean failed;
|
||||||
|
|
||||||
|
// set to true when the test is done
|
||||||
|
static volatile boolean finished;
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
// all accepted connections are added to a queue
|
// all accepted connections are added to a queue
|
||||||
final ArrayBlockingQueue<AsynchronousSocketChannel> queue =
|
final ArrayBlockingQueue<AsynchronousSocketChannel> queue =
|
||||||
@ -54,8 +57,10 @@ public class Unbounded {
|
|||||||
listener.accept((Void)null, this);
|
listener.accept((Void)null, this);
|
||||||
}
|
}
|
||||||
public void failed(Throwable exc, Void att) {
|
public void failed(Throwable exc, Void att) {
|
||||||
failed = true;
|
if (!finished) {
|
||||||
System.err.println("accept failed: " + exc);
|
failed = true;
|
||||||
|
System.err.println("accept failed: " + exc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
System.out.println("Listener created.");
|
System.out.println("Listener created.");
|
||||||
@ -120,8 +125,11 @@ public class Unbounded {
|
|||||||
// wait for all threads to reach the barrier
|
// wait for all threads to reach the barrier
|
||||||
System.out.println("Waiting for all threads to reach barrier");
|
System.out.println("Waiting for all threads to reach barrier");
|
||||||
barrier.await();
|
barrier.await();
|
||||||
|
|
||||||
|
// finish up
|
||||||
|
finished = true;
|
||||||
listener.close();
|
listener.close();
|
||||||
if (failed)
|
if (failed)
|
||||||
throw new RuntimeException("I/O failed failed, see log for details");
|
throw new RuntimeException("I/O operation failed, see log for details");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user