This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Does Threads have the same name ?  RSS feed

 
samir ware
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am trying to keep set of values in the hashmap for each of the generated thread. I am planning to use name of the thread as a key in the hashmap and value will be some object. Is it possible that the 2 threads can have the same name ? If yes , then what could be the way by which I can identify 2 threads uniquely.
Thanks in advance
Samir
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you are trying to do is already available via ThreadLocals

As for your question about thread names, if you are not explicitly setting the name then every thread will have a unique name.
If you are setting it explicitly to the same name, i am not sure what happens.
 
samir ware
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nitesh,
Thanks a lot...that really helps.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!