Hot Swap

Hot Swap (class redefinition while the target JVM is executing) is a new JPDA (Java Platform Debugger Architecture) feature implemented in JDK 1.4. For example, one can recompile a single class and replace the old instance with the new instance. Example uses of Hot Swap are: Hot Swap is performed in the GUI by selecting a class in the Loaded Classes Panel and selecting the Hot Swap... menu item from the right click popup context menu. Or Hot Swap is performed in the GUI by selecting the Hot Swap... menu item from the right click popup context menu in the source file currently displayed in the Source Panel, for the corresponding class containing the blinking cursor.

If there are currently multiple classes by the same name loaded into the target JVM (by multiple ClassLoaders), you will be prompted to confirm that you really want to try and Hot Swap them all. If so, then the number of classes successfully Hot Swapped will be reported.

If any redefined methods have active stack frames, those active frames continue to run the bytecodes of the previous method. The redefined methods will be used on new invocations.

If you are suspended in the method that is going to be Hot Swapped, and you want to re-execute the method with the new code, you can first Pop a frame(s) off the stack. Then Hot Swap the corresponding class and then you can step into the (popped off) method(s) again and execute the new code.

After a class has been Hot Swapped, breakpoints that are currently set in that class, will be re-resolved.

Check the Target Info Dialog to see the Hot Swap capabilities of the target JVM:

A Hot Swap operation can return the following errors: For more details on Hot Swap, see the JPDA documentation.

©2001-2010. debugtools.com LLC. All rights reserved.