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

feat(all): tune single Thread into SingleThreadExecutor #5410

Merged
merged 5 commits into from
Aug 15, 2023

Conversation

halibobo1205
Copy link
Contributor

This is #5362 's first PR. close #5409.

@halibobo1205 halibobo1205 changed the title feat(*): tune single Thread into SingleThreadExecutor feat(all): tune single Thread into SingleThreadExecutor Aug 9, 2023
@halibobo1205 halibobo1205 added this to the GreatVoyage-v4.7.3 milestone Aug 10, 2023
@halibobo1205 halibobo1205 self-assigned this Aug 10, 2023
if (!pool.awaitTermination(60, java.util.concurrent.TimeUnit.SECONDS)) {
pool.shutdownNow(); // Cancel currently executing tasks
// Wait a while for tasks to respond to being cancelled
if (!pool.awaitTermination(60, java.util.concurrent.TimeUnit.SECONDS)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why there are two waits of 60s, will the 60s time be too long?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

60s is the maximum value to be waited until the pool stops, if it doesn't, the pool may have a problem executing the task and needs to be fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

// start json rpc filter process
if (CommonParameter.getInstance().isJsonRpcFilterEnabled()) {
Thread filterProcessThread = new Thread(filterProcessLoop);
filterProcessThread.start();
filterEs = ExecutorServiceManager.newSingleThreadExecutor(filterEsName, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isDaemon original default value is false

}
logger.info("DPoS task stopped.");
ExecutorServiceManager.shutdownAndAwaitTermination(produceExecutor, name);
logger.info("DPoS task shutdown complete");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the thread shutdown log be printed in the function shutdownAndAwaitTermination?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, Great!

@codecov-commenter
Copy link

Codecov Report

Merging #5410 (87c1b5d) into develop (61c6177) will increase coverage by 0.02%.
Report is 2 commits behind head on develop.
The diff coverage is 72.91%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@              Coverage Diff              @@
##             develop    #5410      +/-   ##
=============================================
+ Coverage      60.92%   60.94%   +0.02%     
- Complexity      9231     9242      +11     
=============================================
  Files            839      840       +1     
  Lines          50038    50059      +21     
  Branches        5576     5577       +1     
=============================================
+ Hits           30484    30509      +25     
+ Misses         17165    17152      -13     
- Partials        2389     2398       +9     
Files Changed Coverage Δ
...java/org/tron/core/config/TronLogShutdownHook.java 0.00% <0.00%> (ø)
...ava/org/tron/common/es/ExecutorServiceManager.java 63.63% <63.63%> (ø)
...mework/src/main/java/org/tron/core/db/Manager.java 56.77% <77.77%> (+0.03%) ⬆️
...rc/main/java/org/tron/consensus/dpos/DposTask.java 90.16% <80.00%> (-3.39%) ⬇️
...re/net/service/nodepersist/NodePersistService.java 32.50% <80.00%> (-0.84%) ⬇️
...va/org/tron/common/backup/socket/BackupServer.java 41.50% <100.00%> (+25.18%) ⬆️

... and 6 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@halibobo1205 halibobo1205 merged commit a9c4f43 into tronprotocol:develop Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tune single Thread into SingleThreadExecutor
5 participants