开发者

Start/Stop JVM [duplicate]

开发者 https://www.devze.com 2023-01-24 18:51 出处:网络
This question already has answers here: 开发者_运维问答Closed 12 years ago. Possible Duplicate: Are there any Java VMs which can save their state to a file and then reload that state?
This question already has answers here: 开发者_运维问答 Closed 12 years ago.

Possible Duplicate:

Are there any Java VMs which can save their state to a file and then reload that state?

Is there a way to stop the JVM, save its states in the hard disk and then resume the execution from the same point it was stopped? Something like the hibernation of windows, linux, etc?


When it's running on a Unix, you can certainly suspend it by e.g. hitting "^Z" on the command line you started it from, or sending it a SIGSTOP signal. This doesn't quite do what you want. It's not written directly to disk (though it may be swapped out). It won't survive a system restart. Unlike an image file, you can't copy or restore it.

There are also a variety of hacks that let some image based systems (smalltalk, emacs, etc.) "unexec()" themselves and save a copy on a disk. These will break any network connections or open files. Most approaches also require the cooperation of the program being saved, especially to gracefully handle the connections to the outside world being severed.

Finally, you could run the JVM in a VM, and suspend the VM. There, at least, connections to files inside the VM will be saved.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号