Skip to content

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.

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-commenter commented Aug 14, 2023

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 72.91667% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.94%. Comparing base (61c6177) to head (87c1b5d).
⚠️ Report is 562 commits behind head on develop.

Files with missing lines Patch % Lines
...ava/org/tron/common/es/ExecutorServiceManager.java 63.63% 7 Missing and 1 partial ⚠️
...mework/src/main/java/org/tron/core/db/Manager.java 77.77% 2 Missing ⚠️
...rc/main/java/org/tron/consensus/dpos/DposTask.java 80.00% 0 Missing and 1 partial ⚠️
...java/org/tron/core/config/TronLogShutdownHook.java 0.00% 1 Missing ⚠️
...re/net/service/nodepersist/NodePersistService.java 80.00% 0 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@              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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@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

Labels

type:enhancement minor enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tune single Thread into SingleThreadExecutor

5 participants