| Sun Microsystems Laboratories Experimental Stuff | HotSwap Client Tool |
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=4000,suspend=n MyMainClass
In brief, these options tell the JVM to activate the internal data structures supporting
debugger protocol communication, and start listening to the port 4000 in parallel
with your application execution. Naturally, you can choose any port number.
The detailed explanation of these and other JPDA-related options can be found in the
Connection
and Invocation Details section of the JPDA specification.
Note that the above options do not affect the JVM performance if the "client" dynamic
compiler is used by the JVM (that is, the compiler used by default, or if you specify the
-client option when starting the JVM). In other words, the -Xdebug
option does not force the HotSpot VM to turn off the client compiler (as it used to be until
JDK 1.4 Beta 3), and the memory overhead due to the internal debugging data structures
activated is negligible. Unfortunately, if you use the server compiler (-server
option), these options still force the JVM to switch to interpretation-only
mode, which may affect performance significantly. Java Software is currently working on
enabling server compiler in the debugging mode. Thus, if you use the very latest version
of HotSpot, you may check to see if performance really degrades - this problem could
have been already fixed by the time you read this!
tools.jar JDK library
on the CLASSPATH. Thus the command line may look as follows:
java -classpath $JDK14HOME/lib/tools.jar:hsclient1.0.jar sunlabs.hsclient.Main
Upon the first invocation of the tool for a given project, you will have to set some
options in it that usually remain the same for your project afterwards. They are saved
into the configuration file automatically upon tool shutdown. These options are:
JVM menu and
is necessary for establishing network connection with the target VM. You have
to set the same port number that you specified when starting the target JVM
(4000 in the above example).
deployed every time just before you start your
application (you may even include the commands to do that in the script that
starts your app). We fully recognize that this is not an ideal solution; however,
since the JVM itself does not preserve the .class files or the
sources for the classes that it runs, the above method is the only way for you to be
able to compare old and new class versions. Once again, you are not enforced to
do any of the above -- all you lose is a bit of convenience.
JVM/Connect menu item.
If the connection is successfully established, the capabilities of the target
VM with respect to class evolution will be reported. In JDK1.4, only the very
basic capability level is provided, that enables the JVM to hotswap a class if
the only changes in its new version are to method bodies. No other changes,
e.g. adding methods or fields, are supported. Note: we are planning to add more
capabilities in future releases of JDK. In our private experimental code, adding
methods and fields is already supported. These changes may be incorporated into
future versions of JDK.
JVM/View Loaded Classes menu item. This shows just "user" classes,
i.e. Java core classes (java.* and sun.*) are not shown.
JVM/Find Changed Classes
menu item. This iterates over all the classes that you obtained during step 2, and
for each of them finds the old and the new .class file on the file system.
Old and new class paths should be set to enable this operation. Classes
whose versions appear to be different will be listed in the "Classes to Replace" window.
Alternatively, to nominate a class for replacement, you may just double-click on a class
name in the "Loaded classes" window, or load a class through File/Load new class
menu item.
|
This page is: http://www.experimentalstuff.com/Technologies/HotSwapTool/hotswaptool.html Last Modified: Fri, 03 May 2002 19:43:32 GMT copyright (c) 2000-2009, Sun Microsystems |