Correctly construct Executor in microbenchmarks.
Motivation: We should allow our custom Executor to shutdown quickly. Modifications: Call super constructor which correct arguments. Result: Custom Executor can be shutdown quickly.
This commit is contained in:
parent
a60c472fa4
commit
efeec7e390
@ -30,7 +30,7 @@ import org.openjdk.jmh.runner.options.ChainedOptionsBuilder;
|
|||||||
import org.openjdk.jmh.runner.options.OptionsBuilder;
|
import org.openjdk.jmh.runner.options.OptionsBuilder;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.concurrent.SynchronousQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@ -49,8 +49,8 @@ public class AbstractMicrobenchmark {
|
|||||||
|
|
||||||
public static final class HarnessExecutor extends ThreadPoolExecutor {
|
public static final class HarnessExecutor extends ThreadPoolExecutor {
|
||||||
public HarnessExecutor(int maxThreads, String prefix) {
|
public HarnessExecutor(int maxThreads, String prefix) {
|
||||||
super(0, maxThreads, 1L, TimeUnit.DAYS, new SynchronousQueue<Runnable>(),
|
super(maxThreads, maxThreads, 0, TimeUnit.MILLISECONDS,
|
||||||
new DefaultThreadFactory(prefix));
|
new LinkedBlockingQueue<Runnable>(), new DefaultThreadFactory(prefix));
|
||||||
System.out.println("Using harness executor");
|
System.out.println("Using harness executor");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user