public final class Agent
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static IAgentLogger |
LOG
Access to logger.
|
| Constructor and Description |
|---|
Agent() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addMixinInterfacesToBootstrap(JarResource agentJarResource,
java.net.URL agentJarUrl,
java.lang.instrument.Instrumentation inst)
Extract all the mixins from the Agent jar and add them to the bootstrap classloader.
|
static boolean |
canFastPath()
Return true if this Agent can use "fast path" optimizations.
|
static void |
continuePremain(java.lang.String agentArgs,
java.lang.instrument.Instrumentation inst,
long startTime)
Called by the "real" premain() in the BootstrapAgent.
|
static void |
disableFastPath()
Disable "fast path" optimizations for the lifetime of this Agent.
|
static long |
getAgentPremainTimeInMillis() |
static java.lang.String |
getVersion() |
static boolean |
isDebugEnabled() |
static void |
main(java.lang.String[] args) |
public static final IAgentLogger LOG
public static java.lang.String getVersion()
public static boolean isDebugEnabled()
public static boolean canFastPath()
public static void disableFastPath()
public static void continuePremain(java.lang.String agentArgs,
java.lang.instrument.Instrumentation inst,
long startTime)
public static void main(java.lang.String[] args)
public static long getAgentPremainTimeInMillis()
public static void addMixinInterfacesToBootstrap(JarResource agentJarResource, java.net.URL agentJarUrl, java.lang.instrument.Instrumentation inst)
Implementation note: In addition to the mixin interfaces themselves, a small number of dependent classes are extracted into the generated jar and loaded on the bootstrap. These are marked with the LoadOnBootstrap annotation. One class so marked is the InterfaceMixin annotation class itself.
This method duplicates some of the functionality found in the ClassAppender class in the Weaver. This duplication is intentional. This code runs before bootstrap classpath setup is complete. Attempting to reuse the ClassAppender causes one or more classes to be loaded by the "wrong" classloader as described in the top comment to this class. This could be fixed, but would invite later failures during code maintenance if dependencies were re-introduced. It is safer to ensure that code used under these special conditions remains right here.
agentJarResource - the Agent's jar file, or a test jar file for unit testing.agentJarUrl - the Agent's jar URL, or a test URL for unit testing.inst - the JVM instrumentation interface, or a mock for unit testing.