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

Remove unused ThreadBarrier class #37666

Merged
merged 4 commits into from
Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.hamcrest.Matcher;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
Expand Down Expand Up @@ -169,7 +170,7 @@ public void run() {
public void testScaleUp() throws Exception {
final int min = between(1, 3);
final int max = between(min + 1, 6);
final ThreadBarrier barrier = new ThreadBarrier(max + 1);
final CyclicBarrier barrier = new CyclicBarrier(max + 1);

ThreadPoolExecutor pool =
EsExecutors.newScaling(getClass().getName() + "/" + getTestName(), min, max, between(1, 100), randomTimeUnit(),
Expand All @@ -179,16 +180,13 @@ public void testScaleUp() throws Exception {

for (int i = 0; i < max; ++i) {
final CountDownLatch latch = new CountDownLatch(1);
pool.execute(new Runnable() {
@Override
public void run() {
latch.countDown();
try {
barrier.await();
barrier.await();
} catch (Exception e) {
barrier.reset(e);
}
pool.execute(() -> {
latch.countDown();
try {
barrier.await();
barrier.await();
} catch (Exception e) {
throw new AssertionError(e);
}
});

Expand All @@ -207,7 +205,7 @@ public void run() {
public void testScaleDown() throws Exception {
final int min = between(1, 3);
final int max = between(min + 1, 6);
final ThreadBarrier barrier = new ThreadBarrier(max + 1);
final CyclicBarrier barrier = new CyclicBarrier(max + 1);

final ThreadPoolExecutor pool =
EsExecutors.newScaling(getClass().getName() + "/" + getTestName(), min, max, between(1, 100), TimeUnit.MILLISECONDS,
Expand All @@ -217,16 +215,13 @@ public void testScaleDown() throws Exception {

for (int i = 0; i < max; ++i) {
final CountDownLatch latch = new CountDownLatch(1);
pool.execute(new Runnable() {
@Override
public void run() {
latch.countDown();
try {
barrier.await();
barrier.await();
} catch (Exception e) {
barrier.reset(e);
}
pool.execute(() -> {
latch.countDown();
try {
barrier.await();
barrier.await();
} catch (Exception e) {
throw new AssertionError(e);
}
});

Expand Down