Sunday, August 1, 2010

Java - ThreadMXBean

Java Management really make debugging easier. However, with IDE such as Eclipse, we may not use them in development environment.

But, if you want to debug in a remote environment whereby you have difficulty attaching your Eclipse debugger to the machine, you may appreciate Java Management Tools.

For this part, I will mention about Thread management

ThreadMXBean - The management interface for the thread system of the Java virtual machine.


This management class give you information about all the threads within the JVM. You can use it to provide deadlock information, thread CPU usage, detail thread stack trace etc..

The best part of it, you can write the code as jsp and simple attach the jsp to your remote server. This way, you can create your much desired remote debugging web tools and you can access real-time debugging information via browser at any location.

Sample to calculate CPU usage and thread stacktrace.

No comments:

Post a Comment

Windows 7 - STOP 0x0000007B (0xFFFFF880009A97E8 0xFFFFFFFFC0000034 0x0000000000 0x0000000000)

If you encounter STOP 0x0000007B (0xFFFFF880009A97E8 0xFFFFFFFFC0000034 0x0000000000 0x0000000000) blue screen of death. This is very like...