Start/Stop JVM [duplicate]
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.
精彩评论