aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Simple(?) JMX Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Simple(?) JMX Question" Watch "Simple(?) JMX Question" New topic
Author

Simple(?) JMX Question

Saul Tocsin
Greenhorn

Joined: Feb 25, 2012
Posts: 14
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

Joined: Feb 25, 2012
Posts: 14
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Simple(?) JMX Question