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

Tomcat - removing server info

Below are the steps to remove Tomcat Server Information 1. Make sure Tomcat is not running 2. Navigate to "Tomcat Installation"...