Package net.bytebuddy.agent
Interface VirtualMachine
-
- All Known Implementing Classes:
VirtualMachine.AbstractBase,VirtualMachine.ForHotSpot,VirtualMachine.ForOpenJ9
public interface VirtualMachineAn implementation for attachment on a virtual machine. This interface mimics the tooling API's virtual machine interface to allow for similar usage by
ByteBuddyAgentwhere all calls are made via reflection such that this structural typing suffices for interoperability.Note: Implementations are required to declare a static method
attach(String)returning an instance of a class that declares the methods defined byVirtualMachine.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classVirtualMachine.AbstractBaseAn abstract base implementation for a virtual machine.static classVirtualMachine.ForHotSpotA virtual machine attachment implementation for a HotSpot VM or any compatible JVM.static classVirtualMachine.ForOpenJ9A virtual machine attachment implementation for OpenJ9 or any compatible JVM.static classVirtualMachine.ResolverA resolver for the current VM's virtual machine attachment emulation.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddetach()Detaches this virtual machine representation.java.util.PropertiesgetAgentProperties()Loads the target VMs agent properties.java.util.PropertiesgetSystemProperties()Loads the target VMs system properties.voidloadAgent(java.lang.String jarFile)Loads an agent into the represented virtual machine.voidloadAgent(java.lang.String jarFile, java.lang.String argument)Loads an agent into the represented virtual machine.voidloadAgentLibrary(java.lang.String library)Loads a native agent library into the represented virtual machine.voidloadAgentLibrary(java.lang.String library, java.lang.String argument)Loads a native agent library into the represented virtual machine.voidloadAgentPath(java.lang.String path)Loads a native agent into the represented virtual machine.voidloadAgentPath(java.lang.String path, java.lang.String argument)Loads a native agent into the represented virtual machine.java.lang.StringstartLocalManagementAgent()Starts a local management agent.voidstartManagementAgent(java.util.Properties properties)Starts a JMX management agent.
-
-
-
Method Detail
-
getSystemProperties
java.util.Properties getSystemProperties() throws java.io.IOExceptionLoads the target VMs system properties.- Returns:
- The target VM properties.
- Throws:
java.io.IOException- If an I/O exception occurs.
-
getAgentProperties
java.util.Properties getAgentProperties() throws java.io.IOExceptionLoads the target VMs agent properties.- Returns:
- The target VM properties.
- Throws:
java.io.IOException- If an I/O exception occurs.
-
loadAgent
void loadAgent(java.lang.String jarFile) throws java.io.IOExceptionLoads an agent into the represented virtual machine.- Parameters:
jarFile- The jar file to attach.- Throws:
java.io.IOException- If an I/O exception occurs.
-
loadAgent
void loadAgent(java.lang.String jarFile, @MaybeNull java.lang.String argument) throws java.io.IOExceptionLoads an agent into the represented virtual machine.- Parameters:
jarFile- The jar file to attach.argument- The argument to provide ornullif no argument should be provided.- Throws:
java.io.IOException- If an I/O exception occurs.
-
loadAgentPath
void loadAgentPath(java.lang.String path) throws java.io.IOExceptionLoads a native agent into the represented virtual machine.- Parameters:
path- The agent path.- Throws:
java.io.IOException- If an I/O exception occurs.
-
loadAgentPath
void loadAgentPath(java.lang.String path, @MaybeNull java.lang.String argument) throws java.io.IOExceptionLoads a native agent into the represented virtual machine.- Parameters:
path- The agent path.argument- The argument to provide ornullif no argument should be provided.- Throws:
java.io.IOException- If an I/O exception occurs.
-
loadAgentLibrary
void loadAgentLibrary(java.lang.String library) throws java.io.IOExceptionLoads a native agent library into the represented virtual machine.- Parameters:
library- The agent library.- Throws:
java.io.IOException- If an I/O exception occurs.
-
loadAgentLibrary
void loadAgentLibrary(java.lang.String library, @MaybeNull java.lang.String argument) throws java.io.IOExceptionLoads a native agent library into the represented virtual machine.- Parameters:
library- The agent library.argument- The argument to provide ornullif no argument should be provided.- Throws:
java.io.IOException- If an I/O exception occurs.
-
startManagementAgent
void startManagementAgent(java.util.Properties properties) throws java.io.IOExceptionStarts a JMX management agent.- Parameters:
properties- The properties to transfer to the JMX agent.- Throws:
java.io.IOException- If an I/O error occurs.
-
startLocalManagementAgent
java.lang.String startLocalManagementAgent() throws java.io.IOExceptionStarts a local management agent.- Returns:
- The local connector address.
- Throws:
java.io.IOException- If an I/O error occurs.
-
detach
void detach() throws java.io.IOExceptionDetaches this virtual machine representation.- Throws:
java.io.IOException- If an I/O exception occurs.
-
-