public final class NIdClassLoaderRegistry extends Object
Guarantees that for the same GAV (longName), exactly one
DefaultNLeafClassLoader is ever created in this VM, so Class
identity is preserved across workspaces, searches, and mutable extension
classloaders.
Mirror-de-duplication comes for free: entries with the same longName but different paths/mirrors simply return the already-registered leaf.
All methods are thread-safe. Entries are held with strong references to respect JVM class identity semantics (leaves are pinned as long as any Class they defined is reachable, which is effectively forever for most workloads).
Lifecycle note: Registry entries and leaf indexes are held for the lifetime
of the JVM unless explicitly invalidated via invalidate(NId),
invalidate(NPath), or invalidateAll(). Applications embedding
Nuts in long-running processes should manage registry lifecycle when extensions
are dynamically loaded and discarded.
| Modifier and Type | Method and Description |
|---|---|
static ClassLoader |
getIfPresent(NId id) |
static ClassLoader |
getIfPresent(NPath path) |
static void |
invalidate(NId id) |
static void |
invalidate(NPath path) |
static void |
invalidateAll() |
static void |
invalidateCache() |
static void |
invalidateClass(String className) |
static boolean |
LEAF_PARENT(ClassLoader c) |
public static boolean LEAF_PARENT(ClassLoader c)
public static ClassLoader getIfPresent(NId id)
public static ClassLoader getIfPresent(NPath path)
public static void invalidate(NId id)
public static void invalidate(NPath path)
public static void invalidateAll()
public static void invalidateCache()
public static void invalidateClass(String className)
Copyright © 2026 vpc open source initiative. All rights reserved.