Skip to content

Commit

Permalink
调整默认线程数
Browse files Browse the repository at this point in the history
  • Loading branch information
Dahai committed Aug 18, 2023
1 parent 9bb15d4 commit 9ff75ec
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class ThreadPoolUtils {

private static final int CPU_SIZE_2 = 2 * CPU_SIZE;

private static final int CPU_SIZE_4 = 4 * CPU_SIZE;
private static final int CPU_SIZE_8 = 8 * CPU_SIZE;

private static ThreadPoolExecutor THREAD_POOL_BUILD;

Expand All @@ -50,10 +50,10 @@ public class ThreadPoolUtils {

public static void initThreadPool() {
ComponentConstants componentConstants = SpringBeanContext.getBean(ComponentConstants.class);
int buildCore = CPU_SIZE_2;
int buildMax = CPU_SIZE_4;
int deploymentCore = CPU_SIZE_2;
int deploymentMax = CPU_SIZE_4;
int buildCore = CPU_SIZE_8;
int buildMax = CPU_SIZE_8;
int deploymentCore = CPU_SIZE_8;
int deploymentMax = CPU_SIZE_8;
if(componentConstants.getThreadPoolBuildCore() != null) {
buildCore = componentConstants.getThreadPoolBuildCore();
}
Expand All @@ -72,15 +72,15 @@ public static void initThreadPool() {
buildMax,
5,
TimeUnit.SECONDS,
new ArrayBlockingQueue<Runnable>(5),
new ArrayBlockingQueue<Runnable>(8),
threadFactory("build-pool-%d"));

THREAD_POOL_DEPLOYMENT = new ThreadPoolExecutor(
deploymentCore,
deploymentMax,
5,
TimeUnit.SECONDS,
new ArrayBlockingQueue<Runnable>(5),
new ArrayBlockingQueue<Runnable>(8),
threadFactory("deployment-pool-%d"));
}

Expand Down

0 comments on commit 9ff75ec

Please sign in to comment.