@HashCodeAndEqualsPlugin.Enhance public class NexusAccessor extends Object
Nexus
such that it can be seen by all class loaders of
a virtual machine. Furthermore, it provides an API to access this global instance.Modifier and Type | Class and Description |
---|---|
protected static interface |
NexusAccessor.Dispatcher
A dispatcher for registering type initializers in the
Nexus . |
static class |
NexusAccessor.InitializationAppender
An initialization appender that looks up a loaded type initializer from Byte Buddy's
Nexus . |
Constructor and Description |
---|
NexusAccessor()
Creates a new accessor for the
Nexus without any active management of stale references within a nexus. |
NexusAccessor(ReferenceQueue<? super ClassLoader> referenceQueue)
Creates a new accessor for a
Nexus where any GC eligible are enqueued to the supplied reference queue. |
Modifier and Type | Method and Description |
---|---|
static void |
clean(Reference<? extends ClassLoader> reference)
Removes a stale entries that are registered in the
Nexus . |
static boolean |
isAlive()
Checks if this
NexusAccessor is capable of registering loaded type initializers. |
void |
register(String name,
ClassLoader classLoader,
int identification,
LoadedTypeInitializer loadedTypeInitializer)
Registers a loaded type initializer in Byte Buddy's
Nexus which is injected into the system class loader. |
public NexusAccessor()
Nexus
without any active management of stale references within a nexus.public NexusAccessor(ReferenceQueue<? super ClassLoader> referenceQueue)
Nexus
where any GC eligible are enqueued to the supplied reference queue. Any such enqueued
reference can be explicitly removed from the nexus via the clean(Reference)
method. Nexus entries can
become stale if a class loader is garbage collected after a class was loaded but before a class was initialized.referenceQueue
- The reference queue onto which stale references should be enqueued or null
if no reference queue
should be notified.public static boolean isAlive()
NexusAccessor
is capable of registering loaded type initializers.true
if this accessor is alive.public static void clean(Reference<? extends ClassLoader> reference)
Nexus
. Entries can become stale if a class is loaded but never initialized
prior to its garbage collection. As all class loaders within a nexus are only referenced weakly, such class loaders are always garbage
collected. However, the initialization data stored by Byte Buddy does not become eligible which is why it needs to be cleaned explicitly.reference
- The reference to remove. References are collected via a reference queue that is supplied to the NexusAccessor
.public void register(String name, ClassLoader classLoader, int identification, LoadedTypeInitializer loadedTypeInitializer)
Nexus
which is injected into the system class loader.Copyright © 2014–2020. All rights reserved.