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

fix: avoid the maximum number of threads being smaller than the number of core threads #53

Merged
merged 1 commit into from
Feb 26, 2024
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
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
Loading