• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can you assign unique thread ids and access thread from external program?

 
Prasad prap
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am currently implementing a program that requires me to handle threads and process.

IDEA:

1. There are multiple java processes running and each process may have multiple threads. Current java implementation is such that thread ids in java is unique for a particular process but not within the processes. So is there a way I could implement a unique thread ids among multiple processes?

2.Also, I need to implement an external java program that monitors these threads. By monitoring I mean, depending upon some logic I need to notify a particular thread(using unique thread id) regarding an event. Is there a way that I can access thread from external program. If yes how?

3) Can I use ThreadGroup for this? How does this work?

Are there any other solutions to implement the similar idea?

Thank you in advance.
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I expect you could do something like that with a suitable JMX monitoring design. Particularly your question (2).
 
Prasad prap
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey thats great. But I still have a question that whether I will be getting the thread info of all the processes?
For eg:

Suppose there are two processes A, B and each process has three threads 1,2,3.
So using JMX will that be possible to get information about A:1, A:2, A:3 and B:1, B:2, B:3?
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As long as the data is available to Java code it is available to JMX (which of course is just Java code itself).
 
Prasad prap
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I mean to say is that can I get all process and thread information at once?
Like is it possible for me to access any process any thread?
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What part of my previous answer did you not understand?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic