-
Notifications
You must be signed in to change notification settings - Fork 114
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 p2p taskStatus disappear issue #881
Conversation
@@ -23,6 +23,7 @@ public TaskRequestActiveNodes(final IP2pMgr _mgr, final Logger p2pLOG) { | |||
public void run() { | |||
INode node = mgr.getRandom(); | |||
if (node != null) { | |||
Thread.currentThread().setName("p2p-reqNodes"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we have to set the thread's name, would it make sense for TaskRequestActiveNodes to extend Thread instead of implement Runnable? I feel like we're assuming things about which thread this Runnable will be in, so why not just make it a Thread?
alternatively, make the thread-name-setting happen in P2pMgr line 231 instead (set the name before starting threadStatus)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the purpose to use runnable is for saving the memory overhead, cause the task only executing run()
method. you don't need to create a lot of objects by extending it to a Thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set the thead name mainly for more readable when you are using jstack to debug the thread info.
Notice
It is not allowed to submit your PR to the master branch directly, please submit your PR to the master-pre-merge branch.
Description
Please include a brief summary of the change that this pull request proposes. Include any relevant motivation and context. List any dependencies required for this change.
reqnodestasks
thread blocking the pool. Therefore, I use dedicated thread instead of using the sharing thread pool to avoid the blocking.Fixes Issue # .
Type of change
Insert x into the following checkboxes to confirm (eg. [x]):
Testing
Please describe the tests you used to validate this pull request. Provide any relevant details for test configurations as well as any instructions to reproduce these results.
Verification
Insert x into the following checkboxes to confirm (eg. [x]):