Skip to content

Commit

Permalink
fix: avoid the maximum number of threads being smaller than the numbe…
Browse files Browse the repository at this point in the history
…r of core threads (#53)
  • Loading branch information
coryhh authored Feb 26, 2024
1 parent a08a7ea commit 4e0818e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion arex-compare-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>arex-compare-parent</artifactId>
<groupId>com.arextest</groupId>
<version>0.2.9</version>
<version>0.2.10</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
public class TaskThreadFactory {

private static final int CORE_SIZE = Runtime.getRuntime().availableProcessors();
private static final int CORE_POOL_SIZE = 4;
private static final int MAX_POOL_SIZE = CORE_SIZE + 1;
private static final int QUENE_SIZE = 500;
public static ExecutorService jsonObjectThreadPool = new ThreadPoolExecutor(CORE_POOL_SIZE,
public static ExecutorService jsonObjectThreadPool = new ThreadPoolExecutor(CORE_SIZE,
MAX_POOL_SIZE,
1, TimeUnit.MINUTES, new LinkedBlockingQueue<>(QUENE_SIZE),
new NamedThreadFactory("JsonObject"),
new CallerRunsPolicyWithReport("JsonObject"));
public static ExecutorService structureHandlerThreadPool = new ThreadPoolExecutor(CORE_POOL_SIZE,
public static ExecutorService structureHandlerThreadPool = new ThreadPoolExecutor(CORE_SIZE,
MAX_POOL_SIZE,
1, TimeUnit.MINUTES, new LinkedBlockingQueue<>(QUENE_SIZE),
new NamedThreadFactory("structureHandler"),
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.arextest</groupId>
<artifactId>arex-compare-parent</artifactId>
<packaging>pom</packaging>
<version>0.2.9</version>
<version>0.2.10</version>
<modules>
<module>arex-compare-extension</module>
<module>arex-compare-core</module>
Expand Down

0 comments on commit 4e0818e

Please sign in to comment.