public class Installer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.lang.instrument.Instrumentation |
instrumentation
A field for carrying the
Instrumentation that was loaded by the Byte Buddy
agent. |
Modifier | Constructor and Description |
---|---|
private |
Installer()
The installer provides only
static hook-in methods and should not be instantiated. |
Modifier and Type | Method and Description |
---|---|
static void |
agentmain(java.lang.String agentArguments,
java.lang.instrument.Instrumentation instrumentation)
Allows the installation of this agent via the Attach API.
|
static java.lang.instrument.Instrumentation |
getInstrumentation()
Returns the instrumentation that was loaded by the Byte Buddy agent.
|
static void |
premain(java.lang.String agentArguments,
java.lang.instrument.Instrumentation instrumentation)
Allows the installation of this agent via a command line argument.
|
private static volatile java.lang.instrument.Instrumentation instrumentation
Instrumentation
that was loaded by the Byte Buddy
agent. Note that this field must never be accessed directly as the agent is injected into the VM's
system class loader. This way, the field of this class might be null
even after the installation
of the Byte Buddy agent as this class might be loaded by a different class loader than the system class
loader.private Installer()
static
hook-in methods and should not be instantiated.public static java.lang.instrument.Instrumentation getInstrumentation()
Returns the instrumentation that was loaded by the Byte Buddy agent. When a security manager is active,
the RuntimePermission
for getInstrumentation
is required by the caller.
Important: This method must only be invoked via the ClassLoader.getSystemClassLoader()
where any
Java agent is loaded. It is possible that two versions of this class exist for different class loaders.
public static void premain(java.lang.String agentArguments, java.lang.instrument.Instrumentation instrumentation)
agentArguments
- The unused agent arguments.instrumentation
- The instrumentation instance.public static void agentmain(java.lang.String agentArguments, java.lang.instrument.Instrumentation instrumentation)
agentArguments
- The unused agent arguments.instrumentation
- The instrumentation instance.