experimental java binding to criu currently using project panama.
public static void main(String[] args) throws IOException {
try(CRIUContext criu = CRIUContext.create()
.logFile("criu.log").logLevel(INFO).tcpEstablished(false).leaveRunning(false)) {
Path path = Paths.get("/tmp/freezer");
if(!Files.exists(path))
Files.createDirectory(path);
System.out.println("pre checkpoint pid: "+ProcessHandle.current().pid());
criu.checkpoint(path);
System.out.println("post checkpoint/restore pid: "+ProcessHandle.current().pid());
}
}
$ sudo jdk-19-panama+1-13/bin/java -XX:-UsePerfData -Xmx42m -XX:+UseSerialGC\
--enable-preview --add-modules jdk.incubator.foreign --enable-native-access=ALL-UNNAMED\
-cp test.jar:JCRIU-x.x-SNAPSHOT.jar foo.Test
WARNING: Using incubator modules: jdk.incubator.foreign
pre checkpoint pid: 8845
$ sudo criu restore --shell-job -D /tmp/freezer/
post checkpoint/restore pid: 8845
This project is distributed under the MIT License, see LICENSE file.