Skip to content

v1.5.0

Latest

Choose a tag to compare

@hooji hooji released this 17 Apr 21:58
91a92e5

What's New

Portable snapshots

Snapshots now carry richer JVM metadata and can optionally bundle the user's class file bytes for fully self-contained restore.

  • SnapshotEnvironment gains six new fields populated from system properties at freeze time: javaRuntimeVersion (e.g. 21.0.2+13-LTS), javaVendor (Temurin / Oracle / Corretto / GraalVM), javaVmName (HotSpot / OpenJ9 / GraalVM), javaSpecificationVersion, osArch, and archDataModel. A restore-side tool can tell an operator exactly which JDK to provision instead of just "Java 21".
  • New opt-in Durable.setEmbedClassBytecodes(boolean) toggle. When enabled, every user class reachable from the snapshot is bundled inside SnapshotEnvironment.ClassEntry.bytecode. On restore, EmbeddedClassInstaller writes a temp jar and calls Instrumentation.appendToSystemClassLoaderSearch so missing classes become loadable. Default is off (smaller snapshots for the common same-classpath case); turn on for portable checkpoints.

Backwards compatible: older snapshots deserialize with the new fields null via Java's standard missing-field handling (SUID unchanged).

Internal refactors (no behavior change)

  • JdiHelper split into three focused files: PortEnumerator (per-OS listening-port enumeration), PortProber (parallel JDI probes + nonce verification with hard per-probe timeouts), SelfConnection (singleton self-attach lifecycle). Makes the self-attach subsystem easier to navigate and independently extractable.
  • New internal/handlers/ package: every JDK-type quirk (collections, StringBuilder, boxed primitives, BigDecimal/UUID/java.time.*, enums, java.lang.Object sentinel, opaque fail-fast, regular-object Objenesis path) now lives in a single TypeHandler file that pairs capture and restore. JdiHeapWalker dropped from ~1240 lines to ~160; HeapRestorer from ~450 to ~210. Ordering-sensitive dispatch documented in TypeHandlerRegistry.

API additions

  • Durable.setEmbedClassBytecodes(boolean) / Durable.isEmbedClassBytecodes()
  • SnapshotEnvironment.javaRuntimeVersion(), javaVendor(), javaVmName(), javaSpecificationVersion(), osArch(), archDataModel()
  • SnapshotEnvironment.ClassEntry.bytecode()

Tests

232 unit tests (+13), 46 E2E tests (+1). Every JDK-type handler retains its prior correctness; new tests cover flag toggling, snapshot round-trip with embedded bytes, and environment field round-trip.