Popular Courses

Browse Our Free Resources

  • whitepapers
  • whitepapers
  • webinars
  • blogs

Our Locations

Training Centres

Vancouver, BC
Calgary, AB
Edmonton, AB
Toronto, ON
Ottawa, ON
Montreal, QC
Hunt Valley
Columbia

locations map

Calgary

550 6th Av SW
Suite 475
Calgary, AB
T2P 0S2

Toronto

821A Bloor Street West
Toronto, ON
M6G 1M1

Vancouver

409 Granville St
Suite 902
Vancouver, BC
V6C 1T2

U.S. Office

436 York Road
Suite 1
Jenkintown, PA
19046

Other Locations

Dallas, TX
Miami, FL

JDK 1.5 Thread Monitor

Web Age Solutions Inc.

Introduction

This is a high performance thread monitor that can be used with a Java 1.5 VM. It has been tested with Sun JVM 1.5.

The monitor shows a list of threads and their status. You can select a thread from the list to view a stack trace. The GUI runs in the same address space as the JVM. The monitor and the GUI is developed in C++ following the JVMTI API for maximum performance.

The tool adds minimal performance overhead. You should be able to use it in a high load environment to debug thread deadlock or application hanging issues.

Download and Installation

This tool requires Windows. It has been tested in Windows 2000 but should work in other variants as well.

It needs Java 1.5. It has been tested with Sun JDK 1.5.0.1.

Download the DLL file from here.

Copy the DLL in any folder that is in your PATH. For example C:\WINNT.

How to Use the Tool?

You can use this tool to monitor threads of any Java application. This includes J2EE applications running in an application server (Tomcat or JBoss for example). Only make sure that you are using Sun JDK 1.5 to run the application.

Just add "-agentlib:tm" to the command line. For example:

java -agentlib:tm com.webage.Test

The GUI will open up immediately.

The top half of the screen show the list of threads and their status. Select a thread to view the stack trace in the bottom half of the screen. Click on the Refresh button to refresh both lists.

Detecting Problems

A deadlocked thread will be in "Waiting Indefinitely" status for a long time. Notice, "Waiting Indefinitely" itself is not a bad thing. It simply means that a thread is waiting for notification without a timeout. A thread is supposed to wake up when notification is received. The problem with a deadlocked thread is that the notification never arrives.

If your application is hanging, look at the stack trace of the threads. In the above example, we look at the stack trace of the TP-Processor7 thread running in JBoss. These threads are used by the web container to run Servlets and JSPs. Focus on the first couple of methods of the stack trace. What is the thread doing? Why is it taking so long for the methods to complete? The file name and the line number will really help you narrow down the problem.

Defects

There are no known defects at this point. This tool uses low level code and a defect can bring down the JVM. Test it thoroughly before deciding to use it in production. Please report any defect using the feedback form below.

Licensing and Source Code

You are free to use this tool in any circumstances. There is no warranty of any kind. Web Age is not responsible for any damage of loss caused by this tool.

Source code for this tool can be downloaded here.