7144086: TEST_BUG: java/nio/file/WatchService/SensitivityModifier.java failing intermittently
Alan Bateman
Alan.Bateman at oracle.com
Thu Feb 9 03:46:16 PST 2012
A few days I fixed the @run tag in this test because it was actually
running a different test:
http://hg.openjdk.java.net/jdk8/tl/jdk/rev/c6d6ef8ec2bf
Now that the real test is running it turns out that it has a bug which
causes it hang. I didn't observe this prior to pushing the above change.
The hang is intermittent and is because the test doesn't drain events
correctly between each iteration of the test. It is trivially fixed with
the attached patch.
Thanks,
Alan.
diff --git a/test/java/nio/file/WatchService/SensitivityModifier.java
b/test/java/nio/file/WatchService/SensitivityModifier.java
--- a/test/java/nio/file/WatchService/SensitivityModifier.java
+++ b/test/java/nio/file/WatchService/SensitivityModifier.java
@@ -96,6 +96,7 @@ public class SensitivityModifier {
// drain events (to avoid interference)
do {
+ key.pollEvents();
key.reset();
key = watcher.poll(1, TimeUnit.SECONDS);
} while (key != null);
More information about the nio-dev
mailing list