-
Notifications
You must be signed in to change notification settings - Fork 73
Set names for all internal threads #1410
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
Conversation
| return Executors.newFixedThreadPool(nThreads, getThreadFactory(threadName)); | ||
| } | ||
|
|
||
| private static ThreadFactory getThreadFactory(String threadName) { |
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.
There're few places where similar monitoring threads are opened against different nodes. It seems that those threads will have the same name. Any chance to avoid using the same name for different threads?
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.
Good point.
I've added a static thread factory map so threads with the same name will use the same thread factory which has an atomic counter for each new thread created to differentiate them
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.
Most of driver logs include thread names and the only concern here is to make them less readable. Is there a chance to come up to a shorter thread names? Potentially we can completely rid of class name. Corresponding class name and method could mentioned in the documentation.
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.
Fair point as well. I've removed the classname# part of the thread name and shortened it while still keeping some descriptive name for it.
|
Checkstyle issues should be fixed now |
wrapper/src/main/java/software/amazon/jdbc/util/ExecutorFactory.java
Outdated
Show resolved
Hide resolved
|
@dnovitski Thank you for your efforts making the driver better! |

Summary
Implements issue #1401 to give all threads a name
Description
Additional Reviewers
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.