is there any way (jdk tools or commercial product) to take a "snapshot"
of a running java application, which can be used to restart a new
instance of the application, resuming the execution with the snapshot ?
this is what I call "gespenstering" I implemented it for BBL Forth
and Abundance.
Basically you create a ram image. The catch is how to create the
relocatable tables so that if the program is reloaded somewhere else,
it will be appropriately adjusted.
To implement it in Java would require the careful co-operation of the
writers of the JVM.
see
http://mindprod.com/jgloss/gespenstering.html
I did this back in the DOS days when TSRs made your load address
unstable. You might implement it today by just giving up if the load
address changes.
Saving the RAW ram image could be done with a bit of JNI and some
knowledge of the inner workings so you know what sections of RAM to
save. You then have to build an exe header.
I also implemented Jaunting (where I take stack snapshots). By
restoring the stack state, I can make a program jump backward in time
and pick up where it left off at some previous snapshot.
You would need in intimate knowledge of the JVM to pull this off.
However the difficult part implementing it for the JVM would be
reopening files that were open at the time of the snapshot, including
restoring the state (possibly even including OS buffers).
You might do gesperstering where it is not totally transparent to the
app. You leave it up to the app to close all files on snap and
reopen/restore them on restart.
I called for this as a way of creating instant start apps for Java.
See
http://mindprod.com/project/gespenster.html
The closest I have seen was a now defunct Lotus project called Ensuite
that used serialisation to snap/restore system state.
The JET people are sneaking up on this. The latest release 6.4 in a
way simulates restoring a snapshot of the app just after it has
started. This allows programs to start as quickly as C++ programs.
see
http://mindprod.com/jgloss/jet.html