Skip to content

Commit

Permalink
Use workStealingPool
Browse files Browse the repository at this point in the history
  • Loading branch information
tjake committed Nov 4, 2023
1 parent 4cccd14 commit 03db246
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.google.common.base.Suppliers;

public class PhysicalCoreExecutor {
private static volatile int physicalCoreCount = Math.max(1, Runtime.getRuntime().availableProcessors());
private static volatile int physicalCoreCount = Math.max(1, Runtime.getRuntime().availableProcessors()/2);
private static final AtomicBoolean started = new AtomicBoolean(false);
public static void overrideThreadCount(int threadCount) {
if (!started.compareAndSet(false, true))
Expand All @@ -25,7 +25,7 @@ public static void overrideThreadCount(int threadCount) {

private PhysicalCoreExecutor(int cores) {
assert cores > 0 && cores <= Runtime.getRuntime().availableProcessors() : "Invalid core count: " + cores;
this.pool = new ForkJoinPool(cores);
this.pool = new ForkJoinPool(cores, ForkJoinPool.defaultForkJoinWorkerThreadFactory, null, true);
}

public void execute(Runnable run) {
Expand Down

0 comments on commit 03db246

Please sign in to comment.