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.

Comments

Popular Posts