aboutsummaryrefslogtreecommitdiff
path: root/test/java/nio/channels
diff options
context:
space:
mode:
authoralanb <none@none>2011-05-11 14:57:17 +0100
committeralanb <none@none>2011-05-11 14:57:17 +0100
commitfa4130976787f797fa6df7ad8a5a1c47da4d736d (patch)
treea9f4af19a37d742f8b448d31478eba133ca38cac /test/java/nio/channels
parent105f0e5978354ac8c4439d3ebbac1b644a3b6e38 (diff)
7043425: (fc) ClosedByInterruptException thrown but interrupt status not set
Reviewed-by: dholmes, chegar
Diffstat (limited to 'test/java/nio/channels')
-rw-r--r--test/java/nio/channels/FileChannel/ClosedByInterrupt.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/test/java/nio/channels/FileChannel/ClosedByInterrupt.java b/test/java/nio/channels/FileChannel/ClosedByInterrupt.java
index 24e2119d4..26c3d8978 100644
--- a/test/java/nio/channels/FileChannel/ClosedByInterrupt.java
+++ b/test/java/nio/channels/FileChannel/ClosedByInterrupt.java
@@ -52,13 +52,16 @@ public class ClosedByInterrupt {
fc.write(bb);
}
- // test with 1-8 concurrent threads
- for (int i=1; i<=8; i++) {
+ // test with 1-16 concurrent threads
+ for (int i=1; i<=16; i++) {
System.out.format("%d thread(s)%n", i);
test(f, i);
if (failed)
break;
}
+
+ if (failed)
+ throw new RuntimeException("Test failed");
}
/**
@@ -132,12 +135,14 @@ public class ClosedByInterrupt {
// give the interruptible thread a chance
try {
Thread.sleep(rand.nextInt(50));
- } catch (InterruptedException ignore) { }
+ } catch (InterruptedException e) {
+ unexpected(e);
+ }
}
}
} catch (ClosedByInterruptException e) {
if (interruptible) {
- if (Thread.currentThread().isInterrupted()) {
+ if (Thread.interrupted()) {
expected(e + " thrown and interrupt status set");
} else {
unexpected(e + " thrown but interrupt status not set");
@@ -158,7 +163,7 @@ public class ClosedByInterrupt {
}
static void expected(Exception e) {
- System.out.format("%s (not expected)%n", e);
+ System.out.format("%s (expected)%n", e);
}
static void expected(String msg) {