1

I am experimenting with CRaC on Azul JVM. I have built a checkpoint of my program with

$JAVA_CMD -XX:CRaCCheckpointTo=cr -jar target/cractest-0.1.0-standalone.jar

And I can restore it successfully with

$JAVA_CMD -XX:CRaCRestoreFrom=cr

It works all right. In the next step, I want to pass arguments to the program on restore, so the program can pick it up, ideally just like the following:

$JAVA_CMD -XX:CRaCRestoreFrom=cr -- arg1 arg2 arg3

And normally I would access arg1 arg2 arg3 in the String[] args parameter of main, but since we are resuming a checkpoint, we don't have access to that array anymore.

How could I still access the parameters on checkpoint restore? Is it available in some context object during runtime?

erdos
  • 3,135
  • 2
  • 16
  • 27

1 Answers1

3

This is not the way CRaC works. You need to think of it as a running application that has been paused. Just as you can't change the arguments to main() of a running application, you can't do this with CRaC.

What you could do is use the afterRestore() method of a class that implements the Resource interface and read new values from some source (e.g. a file).

Speakjava
  • 3,177
  • 13
  • 15