Top Description Fields Constructors Methods
net.bytebuddy.agent

public Class Attacher

extends Object
Class Inheritance
Imports
edu.umd.cs.findbugs.annotations.SuppressFBWarnings, net.bytebuddy.agent.utility.nullability.MaybeNull, java.io.FileOutputStream, .PrintStream, java.lang.reflect.InvocationTargetException

A Java program that attaches a Java agent to an external process.

Field Summary

Modifier and TypeField and Description
public static final String
DUMP_PROPERTY

Indicates that any error during attachment should be dumped to a given file location.

Constructor Summary

AccessConstructor and Description
private
Attacher()

The attacher provides only static utility methods and should not be instantiated.

Method Summary

Modifier and TypeMethod and Description
protected static void
install(Class<?>
The virtual machine type to use for the external attachment.
virtualMachineType
,
String
The id of the process being target of the external attachment.
processId
,
String
The Java agent to attach.
agent
,
boolean
true if the agent is native.
isNative
,
String
The argument to provide or null if no argument is provided.
argument
)

Installs a Java agent on a target VM.

public static void
main(String[]
A list containing the fully qualified name of the virtual machine type, the process id, the fully qualified name of the Java agent jar followed by an empty string if the argument to the agent is null or any number of strings where the first argument is proceeded by any single character which is stripped off.
args
)

Runs the attacher as a Java application.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DUMP_PROPERTYback to summary
public static final String DUMP_PROPERTY

Indicates that any error during attachment should be dumped to a given file location.

Constructor Detail

Attacherback to summary
private Attacher()

The attacher provides only static utility methods and should not be instantiated.

Method Detail

installback to summary
protected static void install(Class<?> virtualMachineType, String processId, String agent, boolean isNative, String argument) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException

Installs a Java agent on a target VM.

Parameters
virtualMachineType:Class<?>

The virtual machine type to use for the external attachment.

processId:String

The id of the process being target of the external attachment.

agent:String

The Java agent to attach.

isNative:boolean

true if the agent is native.

argument:String

The argument to provide or null if no argument is provided.

Exceptions
NoSuchMethodException:
If the virtual machine type does not define an expected method.
InvocationTargetException:
If the virtual machine type raises an error.
IllegalAccessException:
If a method of the virtual machine type cannot be accessed.
mainback to summary
public static void main(String[] args)

Runs the attacher as a Java application.

Parameters
args:String[]

A list containing the fully qualified name of the virtual machine type, the process id, the fully qualified name of the Java agent jar followed by an empty string if the argument to the agent is null or any number of strings where the first argument is proceeded by any single character which is stripped off.

Annotations
@SuppressFBWarnings:REC_CATCH_EXCEPTION
justification:Exception should not be rethrown but trigger a fallback.