feat(all): tune single Thread into SingleThreadExecutor#5410
feat(all): tune single Thread into SingleThreadExecutor#5410halibobo1205 merged 5 commits intotronprotocol:developfrom
Conversation
a7968bf to
dbbb75d
Compare
| 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)) { |
There was a problem hiding this comment.
Why there are two waits of 60s, will the 60s time be too long?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
copy from java.util.concurrent.ExecutorService
| if (CommonParameter.getInstance().isJsonRpcFilterEnabled()) { | ||
| Thread filterProcessThread = new Thread(filterProcessLoop); | ||
| filterProcessThread.start(); | ||
| filterEs = ExecutorServiceManager.newSingleThreadExecutor(filterEsName, true); |
There was a problem hiding this comment.
isDaemon original default value is false
| } | ||
| logger.info("DPoS task stopped."); | ||
| ExecutorServiceManager.shutdownAndAwaitTermination(produceExecutor, name); | ||
| logger.info("DPoS task shutdown complete"); |
There was a problem hiding this comment.
Can the thread shutdown log be printed in the function shutdownAndAwaitTermination?
3e0a838 to
87c1b5d
Compare
|
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
This is #5362 's first PR. close #5409.