public class ReplaceCallAgent
extends java.lang.Object
CallReplacementTransformer to replace calls in
loaded classes by calls to alternate implementations.
The transformer applies method call replacements as specified in either the default or a
user-provided replacement file. (See the replacecall user
documentation the file format.) Default replacements are given in an internal resource file
"default-replacements.txt". User replacements are then loaded using the --replacement-file command-line argument. A user replacement may override a default replacement.
The classes of packages listed in the resource file "default-load-exclusions.txt" are
excluded from transformation.
| Modifier and Type | Field and Description |
|---|---|
static boolean |
debug
Run the replacecall agent in debug mode.
|
static @Nullable java.lang.String |
debug_directory
The directory where debug logs are written when
debug is set. |
static @Nullable java.nio.file.Path |
dont_transform
Exclude transformation of classes in the listed packages.
|
static @Nullable java.nio.file.Path |
replacement_file
The file from which to read the user replacements for replacing calls.
|
static boolean |
verbose |
| Constructor and Description |
|---|
ReplaceCallAgent() |
| Modifier and Type | Method and Description |
|---|---|
protected static java.lang.String |
getJarPathFromURL(java.net.URL url)
Extracts the path from a URL of type jar.
|
static void |
premain(java.lang.String agentArgs,
java.lang.instrument.Instrumentation instrumentation)
Entry point of the replacecall Java agent.
|
public static boolean debug
public static @Nullable java.lang.String debug_directory
debug is set. If no directory is given,
then the current working directory is used.public static boolean verbose
public static @Nullable java.nio.file.Path replacement_file
public static @Nullable java.nio.file.Path dont_transform
public static void premain(java.lang.String agentArgs,
java.lang.instrument.Instrumentation instrumentation)
throws java.io.IOException
CallReplacementTransformer
so that when classes are loaded they are transformed to replace calls to methods as specified
in the replacements file(s).agentArgs - the arguments to the agentinstrumentation - the Instrumentation objectjava.io.IOException - if there is an error reading a fileprotected static java.lang.String getJarPathFromURL(java.net.URL url)
url - the url to extract the path from