Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8224024: java/util/concurrent/BlockingQueue/DrainToFails.java testBounded fails intermittently #1728

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 8 additions & 6 deletions test/jdk/java/util/concurrent/BlockingQueue/DrainToFails.java
Expand Up @@ -35,6 +35,7 @@
/*
* @test
* @summary Test drainTo failing due to c.add throwing
* @library /test/lib
*/

import java.util.ArrayList;
Expand All @@ -50,9 +51,11 @@
import java.util.concurrent.RunnableScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import jdk.test.lib.Utils;

@SuppressWarnings({"unchecked", "rawtypes"})
public class DrainToFails {
static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
final int CAPACITY = 10;
final int SMALL = 2;

Expand Down Expand Up @@ -169,7 +172,7 @@ void testBounded(final BlockingQueue q) throws Throwable {
fail("should throw");
} catch (IllegalStateException success) {
for (Thread putter : putters) {
putter.join(2000L);
putter.join(LONG_DELAY_MS);
check(! putter.isAlive());
}
assertContentsInOrder(q2, 2, 3);
Expand All @@ -183,11 +186,10 @@ void testBounded(final BlockingQueue q) throws Throwable {
}
}

Runnable putter(final BlockingQueue q, final int elt) {
return new Runnable() {
public void run() {
try { q.put(elt); }
catch (Throwable t) { unexpected(t); }}};
Runnable putter(BlockingQueue q, int elt) {
return () -> {
try { q.put(elt); }
catch (Throwable t) { unexpected(t); }};
}

void assertContentsInOrder(Iterable it, Object... contents) {
Expand Down