Package net.bytebuddy.agent
Class VirtualMachine.ForOpenJ9
java.lang.Object
net.bytebuddy.agent.VirtualMachine.AbstractBase
net.bytebuddy.agent.VirtualMachine.ForOpenJ9
- All Implemented Interfaces:
VirtualMachine
- Enclosing interface:
VirtualMachine
A virtual machine attachment implementation for OpenJ9 or any compatible JVM.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
A dispatcher for native operations being used for communication with an OpenJ9 virtual machine.Nested classes/interfaces inherited from interface net.bytebuddy.agent.VirtualMachine
VirtualMachine.AbstractBase, VirtualMachine.ForHotSpot, VirtualMachine.ForOpenJ9, VirtualMachine.Resolver
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
The temporary folder for attachment files for OpenJ9 VMs.private static final SecureRandom
A secure random for generating randomized ids.private final Socket
The socket on which this VM and the target VM communicate. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic VirtualMachine
Attaches to the supplied process id using the default JNA implementation.static VirtualMachine
attach
(String processId, int timeout, VirtualMachine.ForOpenJ9.Dispatcher dispatcher) Attaches to the supplied process id.void
detach()
Detaches this virtual machine representation.Loads the target VMs agent properties.Loads the target VMs system properties.void
Loads an agent into the represented virtual machine.void
loadAgentLibrary
(String library, String argument) Loads a native agent library into the represented virtual machine.void
loadAgentPath
(String path, String argument) Loads a native agent into the represented virtual machine.private static byte[]
Reads a'\0'
-terminated value from the target socket.Starts a local management agent.void
startManagementAgent
(Properties properties) Starts a JMX management agent.private static void
Writes the supplied value to the target socket.Methods inherited from class net.bytebuddy.agent.VirtualMachine.AbstractBase
loadAgent, loadAgentLibrary, loadAgentPath
-
Field Details
-
IBM_TEMPORARY_FOLDER
The temporary folder for attachment files for OpenJ9 VMs.- See Also:
-
SECURE_RANDOM
A secure random for generating randomized ids. -
socket
The socket on which this VM and the target VM communicate.
-
-
Constructor Details
-
ForOpenJ9
Creates a new virtual machine connection for OpenJ9.- Parameters:
socket
- The socket on which this VM and the target VM communicate.
-
-
Method Details
-
attach
Attaches to the supplied process id using the default JNA implementation. This method will not consider attaching to VMs owned by different users than the current user.- Parameters:
processId
- The process id.- Returns:
- A suitable virtual machine implementation.
- Throws:
IOException
- If an IO exception occurs during establishing the connection.
-
attach
public static VirtualMachine attach(String processId, int timeout, VirtualMachine.ForOpenJ9.Dispatcher dispatcher) throws IOException Attaches to the supplied process id.- Parameters:
processId
- The process id.timeout
- The timeout for establishing the socket connection.dispatcher
- The connector to use to communicate with the target VM.- Returns:
- A suitable virtual machine implementation.
- Throws:
IOException
- If an IO exception occurs during establishing the connection.
-
getSystemProperties
Loads the target VMs system properties.- Returns:
- The target VM properties.
- Throws:
IOException
- If an I/O exception occurs.
-
getAgentProperties
Loads the target VMs agent properties.- Returns:
- The target VM properties.
- Throws:
IOException
- If an I/O exception occurs.
-
loadAgent
Loads an agent into the represented virtual machine.- Parameters:
jarFile
- The jar file to attach.argument
- The argument to provide ornull
if no argument should be provided.- Throws:
IOException
- If an I/O exception occurs.
-
loadAgentPath
Loads a native agent into the represented virtual machine.- Parameters:
path
- The agent path.argument
- The argument to provide ornull
if no argument should be provided.- Throws:
IOException
- If an I/O exception occurs.
-
loadAgentLibrary
Loads a native agent library into the represented virtual machine.- Parameters:
library
- The agent library.argument
- The argument to provide ornull
if no argument should be provided.- Throws:
IOException
- If an I/O exception occurs.
-
startManagementAgent
Starts a JMX management agent.- Parameters:
properties
- The properties to transfer to the JMX agent.- Throws:
IOException
- If an I/O error occurs.
-
startLocalManagementAgent
Starts a local management agent.- Returns:
- The local connector address.
- Throws:
IOException
- If an I/O error occurs.
-
detach
Detaches this virtual machine representation.- Throws:
IOException
- If an I/O exception occurs.
-
write
Writes the supplied value to the target socket.- Parameters:
socket
- The socket to write to.value
- The value being written.- Throws:
IOException
- If an I/O exception occurs.
-
read
Reads a'\0'
-terminated value from the target socket.- Parameters:
socket
- The socket to read from.- Returns:
- The value that was read.
- Throws:
IOException
- If an I/O exception occurs.
-