Load pack modules from temporary copies so the original jars stay unlocked

PackModules copies the pack's jars into a fresh iris-pack-modules-*
directory and reads, checks and defines classes from the copies only, so
a load sees one consistent snapshot and the pack class loader never holds
the originals open (on Windows that locked them against rebuilding).
Copies are deleted when the pack closes (after its loader) and on any
load failure. Messages and origins keep naming modules/<jar>, including
an entry class found in another jar of the pack.

Each copy directory holds an owner file with the creating process id. A
later load removes directories whose owner process has exited and that
hold only that file and jars; everything else is left alone.
This commit is contained in:
piexel committed 2026-10-05 21:38:54 +02:00
1 parent fe51496ab0
commit 333e2f6459
6 files changed
+415 -26

No files matched your search

@@ -16,7 +16,8 @@ import java.util.Objects;
*
* A load either returns a complete pack or throws with nothing left open. Close the pack when it
* unloads, after the host has stopped using its graphs, catalog and runners: closing releases the
* pack's class loader.
* pack's class loader and deletes its copies of the module jars. The original jars are never held
* open, so a module author can rebuild them while the pack is loaded.
*/
public final class LoadedPack implements AutoCloseable {
private final PackModules packModules;