{"id":4492,"date":"2014-03-30T11:43:06","date_gmt":"2014-03-30T11:43:06","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/is-it-a-good-idea-to-dynamically-change-the-names-of-processing-threads-in-java-collection-of-common-programming-errors\/"},"modified":"2014-03-30T11:43:06","modified_gmt":"2014-03-30T11:43:06","slug":"is-it-a-good-idea-to-dynamically-change-the-names-of-processing-threads-in-java-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/is-it-a-good-idea-to-dynamically-change-the-names-of-processing-threads-in-java-collection-of-common-programming-errors\/","title":{"rendered":"Is it a good idea to dynamically change the names of processing threads in Java?-Collection of common programming errors"},"content":{"rendered":"<p>We have a Java application that processes requests. Naturally, there is a thread pool with threads named with some insignificant names like &#8220;processor-1&#8221;, &#8220;processor-2&#8221; etc. We are wondering whether it&#8217;s a good idea to rename the processing thread each time it gets a request to a name that would indicate which request is being processed.<\/p>\n<p>I have a feeling that something is wrong about it, but cannot think of a good reason. I can remember several cases of analyzing multi-threading issues from thread dumps and it was very important to me to know whether I see the same thread in two consecutive dumps or not. However, I realize that I could look at the thread ID instead. In log4j logs it&#8217;s a common practice to write the thread name and I remember many cases of filtering by it. But still I&#8217;m not sure I have a good &#8220;line of defense&#8221; here.<\/p>\n<p>What is the common practice? Is it a good idea to keep renaming threads?<\/p>\n<p>There are related questions like Renaming Threads in Java or Should threads in Java be named for easier debugging? but they do not address this specific issue.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We have a Java application that processes requests. Naturally, there is a thread pool with threads named with some insignificant names like &#8220;processor-1&#8221;, &#8220;processor-2&#8221; etc. We are wondering whether it&#8217;s a good idea to rename the processing thread each time it gets a request to a name that would indicate which request is being processed. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4492","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4492","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4492"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4492\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4492"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}