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 VirtualMachineattach(java.lang.String processId)Attaches to the supplied VM process.protected voidconnect()Connects to the target VM.voiddetach()Detaches this virtual machine representation.intread(byte[] buffer)Reads from the communication channel.voidwrite(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.ThrowableAsserts the availability of this virtual machine implementation. If the Unix socket library is missing or if this VM does not support Unix socket communication, aThrowableis 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.IOExceptionDescription copied from class:VirtualMachine.ForHotSpotConnects to the target VM.- Specified by:
connectin classVirtualMachine.ForHotSpot- Throws:
java.io.IOException- If an I/O exception occurs.
-
read
public int read(byte[] buffer) throws java.io.IOExceptionDescription copied from class:VirtualMachine.ForHotSpotReads from the communication channel.- Specified by:
readin 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.IOExceptionDescription copied from class:VirtualMachine.ForHotSpotWrites to the communication channel.- Specified by:
writein 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.IOExceptionDescription copied from interface:VirtualMachineDetaches this virtual machine representation.- Throws:
java.io.IOException- If an I/O exception occurs.
-
-