Package net.bytebuddy.agent
Class VirtualMachine.ForHotSpot.OnUnix
- java.lang.Object
-
- net.bytebuddy.agent.VirtualMachine.ForHotSpot
-
- net.bytebuddy.agent.VirtualMachine.ForHotSpot.OnUnix
-
- All Implemented Interfaces:
VirtualMachine
- Enclosing class:
- VirtualMachine.ForHotSpot
public static class VirtualMachine.ForHotSpot.OnUnix extends VirtualMachine.ForHotSpot
A virtual machine implementation for a HotSpot VM running on Unix.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.bytebuddy.agent.VirtualMachine.ForHotSpot
VirtualMachine.ForHotSpot.OnUnix
-
Nested classes/interfaces inherited from interface net.bytebuddy.agent.VirtualMachine
VirtualMachine.ForHotSpot
-
-
Field Summary
-
Fields inherited from class net.bytebuddy.agent.VirtualMachine.ForHotSpot
processId
-
-
Constructor Summary
Constructors Constructor Description OnUnix(java.lang.String processId, java.lang.Object socket, int attempts, long pause, long timeout, java.util.concurrent.TimeUnit timeUnit)
Creates a new VM implementation for a HotSpot VM running on Unix.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.Class<?>
assertAvailability()
Asserts the availability of this virtual machine implementation.static VirtualMachine
attach(java.lang.String processId)
Attaches to the supplied VM process.protected void
connect()
Connects to the target VM.void
detach()
Detaches this virtual machine representation.int
read(byte[] buffer)
Reads from the communication channel.void
write(byte[] buffer)
Writes to the communication channel.-
Methods inherited from class net.bytebuddy.agent.VirtualMachine.ForHotSpot
loadAgent
-
-
-
-
Constructor Detail
-
OnUnix
public OnUnix(java.lang.String processId, java.lang.Object socket, int attempts, long pause, long timeout, java.util.concurrent.TimeUnit timeUnit)
Creates a new VM implementation for a HotSpot VM running on Unix.- Parameters:
processId
- The process id of the target VM.socket
- The Unix socket to use for communication.attempts
- The number of attempts to connect.pause
- The pause time between two VMs.timeout
- The socket timeout.timeUnit
- The time unit of the pause time.
-
-
Method Detail
-
assertAvailability
public static java.lang.Class<?> assertAvailability() throws java.lang.Throwable
Asserts the availability of this virtual machine implementation. If the Unix socket library is missing or if this VM does not support Unix socket communication, aThrowable
is thrown.- Returns:
- This virtual machine type.
- Throws:
java.lang.Throwable
- If this VM does not support POSIX sockets or is not running on a HotSpot VM.
-
attach
public static VirtualMachine attach(java.lang.String processId) throws java.io.IOException
Attaches to the supplied VM process.- Parameters:
processId
- The process id of the target VM.- Returns:
- An appropriate virtual machine implementation.
- Throws:
java.io.IOException
- If an I/O exception occurs.
-
connect
protected void connect() throws java.io.IOException
Description copied from class:VirtualMachine.ForHotSpot
Connects to the target VM.- Specified by:
connect
in classVirtualMachine.ForHotSpot
- Throws:
java.io.IOException
- If an I/O exception occurs.
-
read
public int read(byte[] buffer) throws java.io.IOException
Description copied from class:VirtualMachine.ForHotSpot
Reads from the communication channel.- Specified by:
read
in classVirtualMachine.ForHotSpot
- Parameters:
buffer
- The buffer to read into.- Returns:
- The amount of bytes read.
- Throws:
java.io.IOException
- If an I/O exception occurs.
-
write
public void write(byte[] buffer) throws java.io.IOException
Description copied from class:VirtualMachine.ForHotSpot
Writes to the communication channel.- Specified by:
write
in classVirtualMachine.ForHotSpot
- Parameters:
buffer
- The buffer to write from.- Throws:
java.io.IOException
- If an I/O exception occurs.
-
detach
public void detach() throws java.io.IOException
Description copied from interface:VirtualMachine
Detaches this virtual machine representation.- Throws:
java.io.IOException
- If an I/O exception occurs.
-
-