Attachment and detachment of a profiler/debugger to a running JVM
Original Publication Date: 2004-Jun-01
Included in the Prior Art Database: 2004-Jun-01
System Java (TM) applications, like Websphere (TM), are becoming more complex with large start up times. Thus it is becoming increasingly important that analysis and/or debugging does not require system shut down. Current technology does not allow attachment of profiler to the Java Virtual Machine (JVM) after the JVM has started. Thus, there is a growing need for such an attachment. General Solution: Enhance the JVM to support a profiler interface which attaches after the JVM is running. We describe three different approaches to this problem.
Attachment and detachment of a profiler /debugger to a running JVM
The JVM creates a socket and a listening thread on that socket at the time the JVM is being initialized. A driver program which attaches to the socket can send commands to the JVM. The commands include: (A) Attach to a profiler with some user specified parameters.
(B) Detach the profiler
For the Attach command, the listening thread loads the profiler and executes the start up sequence. The start up sequence has a new interface that tells the profiler that it is loaded to an already running JVM. The profiler can then issue callbacks to the JVM and enable events to perform the required tasks (that were identified by the parameters sent via the socket to the listening thread.)
At initialization the JVM is told to read something periodically, such as, a file, an environment variable, etc. The file is updated with commands that the JVM eventually reads. Some other program updates the communication vehicle.
The profiler is loaded independently and makes calls to the JVM to perform the required initialization.
The advantage for all 3 approaches is that the profiler can be loaded and started without stopping the application.
(1) Java is a trademark of Sun Microsystems
(2) Websphere is a trademark of International Business Machines