在Eclipse调试器中,什么样的更改可以被“热代码替换”进入正在运行的JVM? [英] In the Eclipse debugger, what kind of changes can be "hot code replaced" into the running JVM?

查看:164
本文介绍了在Eclipse调试器中,什么样的更改可以被“热代码替换”进入正在运行的JVM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Eclipse中,如果您在Debug下运行程序,则可以对代码进行更改,大部分时间将立即生效。

In Eclipse, if you run a program under "Debug" you can make changes to the code, and most of the time it will take effect immediately.

有时但是,在这种情况下,它不会弹出消息,或者在调试窗格中的线程旁边说(可能不同步)。

Sometimes, though, it will not -- in which case it pops up a message, or says "(may be out of sync)" next to the threads in the Debug pane.

什么决定了可以热插拔的更改类型?我注意到这些更改通常会失败:

What determines the kind of changes that can be hot-swapped? I've noticed these changes usually fail:


    在类实例化时,引入新的匿名内部类
  • 更改类(重命名/添加/删除字段和方法)

  • 添加尝试 - 批量块

但有时似乎几乎是随机的。确定代码是否可以替换的逻辑是什么?

but sometimes it seems to be almost random. What is the logic behind determining whether code can be replaced or not?

推荐答案

方法语句(程序代码)工作。与添加,删除或更改类模式相关的一切都不起作用。所以没有修改继承,字段,提取方法,更改签名等。

Method statements (procedural code) work. Everything related to adding, removing or changing class schemas does not work. So no modifying inheritances, fields, extracting methods, changing signatures etc.

如果您同时进行任何禁止的操作,通常热插拔方法语句不起作用。那么热插拔连接是坏的,所以说。

Usually hot-swapping method statements does not work if you are doing anything forbidden at the same time. Then the hot-swapping connection is "broken", so to say.

我不知道的一件事是匿名类。从来没有尝试过与热插拔有关的问题。

One thing I do not know for sure is anonymous classes. Have never tried that in connection with hot-swapping.

编辑:在这个零零零开始的那些人在他们的功能部分编译了一个列表,jvm调试器不能做什么推出他们的产品: http://www.zeroturnaround.com/jrebel/features/。无论您是否喜欢该工具,该列表都反映了我的经验。

The guys over there at zeroturnaround have compiled a list in their features section what the jvm debugger can not do out of the box to promote their product: http://www.zeroturnaround.com/jrebel/features/ . Whether you like the tool or not, the list reflects my experience.

这篇关于在Eclipse调试器中,什么样的更改可以被“热代码替换”进入正在运行的JVM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆