8368098: (aio) java/nio/channels/Channels/AsyncCloseStreams.java fails in junit timeout

Reviewed-by: alanb
This commit is contained in:
Brian Burkhalter 2025-10-13 16:03:43 +00:00
parent 1668162319
commit 8b1cf8eefe

View File

@ -136,12 +136,14 @@ public class AsyncCloseStreams {
try {
Path path = Files.createTempFile(Path.of("."), "foo", "bar");
path.toFile().deleteOnExit();
byte[] bytes = new byte[100_000];
Arrays.fill(bytes, (byte)27);
do {
OutputStream out = Files.newOutputStream(path);
close.offer(out);
try {
out.write(27);
out.write(bytes);
} catch (AsynchronousCloseException ace) {
System.err.println("AsynchronousCloseException caught");
break;