public class InstrumentationAgent extends Object implements ClassFileTransformer
You can enable this agent from command line by adding -javaagent
switch to command line like this:
java -javaagent:<path_to_jiapi.jar> HelloWorldOne can give configuration parameters in command line to this agent and Transformer used. Parameters are given by appending the following to -javaagent switch:
'=name1=value1,name2=value2,....'
This agent regoqnises one parameter: 'transformer=<name_of_the_transformer>. If this parameter is given, It is assumed to be a fully qualified name of a class, that extends net.sf.jiapi.agent.Transformer. If not given, net.sf.jiapi.agent.HotSpotTransformer is used.
Transformer
,
HotSpotTransformer
Constructor and Description |
---|
InstrumentationAgent(Properties p,
Instrumentation i,
Transformer transformer) |
Modifier and Type | Method and Description |
---|---|
static void |
agentmain(String agentArgs,
Instrumentation inst)
This method will be called after VM startup.
|
Properties |
getAgentArgs()
Gets the agent arguments that has been passed during premain(...)
|
Instrumentation |
getInstrumentation()
Gets the Instrumentation associated with this ClassFileTransformer.
|
static void |
premain(String agentArgs,
Instrumentation instrumentation)
This method will be called after VM initialization.
|
byte[] |
transform(ClassLoader cl,
String className,
Class<?> classBeingRedefined,
ProtectionDomain pd,
byte[] classFileBuffer) |
public InstrumentationAgent(Properties p, Instrumentation i, Transformer transformer)
public static void agentmain(String agentArgs, Instrumentation inst)
agentArgs
- argsinst
- Instrumentationpublic static void premain(String agentArgs, Instrumentation instrumentation)
agentArgs
- argsinstrumentation
- Instrumnetationpublic byte[] transform(ClassLoader cl, String className, Class<?> classBeingRedefined, ProtectionDomain pd, byte[] classFileBuffer)
transform
in interface ClassFileTransformer
public Instrumentation getInstrumentation()
public Properties getAgentArgs()
Copyright © 2017. All rights reserved.