JVM HOT Swapping
Asked Answered
D

1

14

What is JVM Hot Swapping?

Many definitions say that this feature allows code to updated on the fly during de-bugging.

And a few restrictions such as hot swapping is limited to updating method bodies only, and trying to add methods and fields to classes would not succeed.

Can anyone explain this with code.

Dour answered 26/11, 2012 at 12:23 Comment(1)
You typically do it from your IDE while debugging/running your code from the IDE. You make changes to a part of your code, hot swap it, and resume running / debugging with the new code without having to recompile or restart your application.Quisling
C
17

All it means is that you can make certain changes to your code while in the middle of a debugging session, and have those changes take effect immediately, without having to restart the application.

This can be a very handy feature in some circumstances. However, you're typically restricted in what kinds of code changes can be hotswapped into a running application. The exact nature of the restrictions depends on your toolchain.

Cristal answered 26/11, 2012 at 12:26 Comment(3)
When not using JRebel, any kind of change to the class structure including a method signature cannot be hot-swapped. Basically only when changing the body of a method it works.Franconian
So does this mean that if a certain code change comes into effect without re-deploying the application then it means that that portion of the code has been hot-swapped.Dour
For hot-swapping to occur should the code be compiled or the hot sapping feature itself compiles the code and hot-swaps.Dour

© 2022 - 2024 — McMap. All rights reserved.