Win a copy of Murach's Python Programming this week in the Jython/Python 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!