solr icon indicating copy to clipboard operation
solr copied to clipboard

Don't create a Thread when there is no thread

Open psalagnac opened this issue 1 year ago • 1 comments

No Jira. This is just to clean-up a bad smell in the code.

Description

We create a java.lang.Thread instance, but this thread is never started. It just acts as a target for another existing thread, from the executor pool. The call to setDaemon() has no effect.

This code was reported by errorprone because of the thread creation without a name (hence the removed @SuppressForbidden)

Replacing the thread by a Runnable makes the full thing cleaner.

Checklist

Please review the following and check all that apply:

  • [x] I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • [x] I have created a Jira issue and added the issue ID to my pull request title.
  • [x] I have given Solr maintainers access to contribute to my PR branch. (optional but recommended)
  • [x] I have developed this patch against the main branch.
  • [x] I have run ./gradlew check.
  • [ ] I have added tests for my changes.
  • [ ] I have added documentation for the Reference Guide

psalagnac avatar Jun 13 '24 15:06 psalagnac

@dsmiley wpuld you like me to shepherd merging this? It looks ready?

epugh avatar Jun 19 '24 17:06 epugh