From b4ac377e67c01b99890f24e353d473a36bf87c16 Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 10 Mar 2008 23:23:47 -0700 Subject: [PATCH] 6595669: regtest LinkedBlockingQueue/OfferRemoveLoops.java fails Reviewed-by: dholmes --- .../concurrent/LinkedBlockingQueue/OfferRemoveLoops.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/java/util/concurrent/LinkedBlockingQueue/OfferRemoveLoops.java b/test/java/util/concurrent/LinkedBlockingQueue/OfferRemoveLoops.java index bcec477ce..baca8f1b0 100644 --- a/test/java/util/concurrent/LinkedBlockingQueue/OfferRemoveLoops.java +++ b/test/java/util/concurrent/LinkedBlockingQueue/OfferRemoveLoops.java @@ -23,7 +23,7 @@ /* * @test - * @bug 6316155 + * @bug 6316155 6595669 * @summary Test concurrent offer vs. remove * @author Martin Buchholz */ @@ -50,15 +50,18 @@ public class OfferRemoveLoops { private static void testQueue(final BlockingQueue q) throws Throwable { System.out.println(q.getClass()); final int count = 10000; + final long quittingTime = System.nanoTime() + 1L * 1000L * 1000L * 1000L; Thread t1 = new ControlledThread() { protected void realRun() { for (int i = 0, j = 0; i < count; i++) - while (! q.remove(String.valueOf(i))) + while (! q.remove(String.valueOf(i)) + && System.nanoTime() - quittingTime < 0) Thread.yield();}}; Thread t2 = new ControlledThread() { protected void realRun() { for (int i = 0, j = 0; i < count; i++) - while (! q.offer(String.valueOf(i))) + while (! q.offer(String.valueOf(i)) + && System.nanoTime() - quittingTime < 0) Thread.yield();}}; t1.setDaemon(true); t2.setDaemon(true); t1.start(); t2.start(); -- GitLab