• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Simple(?) JMX Question

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I wasn't quite sure in which forum to post something related to JMX. A search revealed a few JMX posts in this forum....

I have a relatively simple Java class that I start on Node2 as follows:

java -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=Node2 -jar amqpConsumer.jar

When this class starts, it obtains and displays its thread ID. The threadID value displayed is "1". The thread then blocks, waiting for messages to be sent by an AMQP producer.

While the thread on Node2 is waiting, I fire up on Node1 a JMX client that I copied from a very helpful example I found on the Web. The core of this JMX client code looks like this:



Pretty much everything seems to work: the client on Node1 connects to the agent on Node2 and displays threadID, thread name, and thread state for each thread:

45:JMX server connection timeout 45 / TIMED_WAITING
44:RMI TCP Connection(41)-71.100.15.51 / RUNNABLE
43:RMI TCP Connection(40)-71.100.15.51 / RUNNABLE
18:RMI Scheduler(0) / TIMED_WAITING
16: DestroyJavaVM / RUNNABLE
15:AMQP Connection 71.100.100.90:5672 / RUNNABLE
14:SimpleAsyncTaskExecutor-1 / TIMED_WAITING
13:AMQP Connection 71.100.100.90:5672 / RUNNABLE
12:RMI TCP Accept-0 / RUNNABLE
11:RMI TCP Accept-9999 / RUNNABLE
10:RMI TCP Accept-0 / RUNNABLE
5:Attach Listener / RUNNABLE
4:Signal Dispatcher / RUNNABLE
3:Finalizer / WAITING
2:Reference Handler / WAITING


But notice that there is no threadID 1.

Perhaps incorrectly, I have assumed that in talking to the JVM's JMX agent, I should be able to enumerate all of the threads known to that JVM. So I am presently baffled as to why I don't see my thread returned by

Is there some way in which I must instrument my class so that it becomes visible to the JVM's JMX agent?

Thank you for your help.

-Paul
 
Saul Tocsin
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All, turns out this was a dumb mistake on my part.

Thread ID 1 terminated and that's why it's no longer visible. I incorrectly thought that it was blocking when, in fact, it started up a listener as a distinct thread and then terminated.

-P
 
The world's cheapest jedi mind trick: "Aw c'mon, why not read this tiny ad?"
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic