Package net.bytebuddy.agent
Class VirtualMachine.ForHotSpot.Connection.Factory.ForSocketFile
- java.lang.Object
-
- net.bytebuddy.agent.VirtualMachine.ForHotSpot.Connection.Factory.ForSocketFile
-
- All Implemented Interfaces:
VirtualMachine.ForHotSpot.Connection.Factory
- Enclosing interface:
- VirtualMachine.ForHotSpot.Connection.Factory
public abstract static class VirtualMachine.ForHotSpot.Connection.Factory.ForSocketFile extends java.lang.Object implements VirtualMachine.ForHotSpot.Connection.Factory
A factory for attaching via a socket file.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.agent.VirtualMachine.ForHotSpot.Connection.Factory
VirtualMachine.ForHotSpot.Connection.Factory.ForSocketFile
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringATTACH_FILE_PREFIXThe name prefix for an attachment file indicator.private intattemptsThe maximum amount of attempts for checking the establishment of a socket connection.private longpauseThe pause between two checks for an established socket connection.private static java.lang.StringSOCKET_FILE_PREFIXThe name prefix for a socket.private java.lang.StringtemporaryDirectoryThe temporary directory to use.private java.util.concurrent.TimeUnittimeUnitThe time unit of the pause time.
-
Constructor Summary
Constructors Modifier Constructor Description protectedForSocketFile(java.lang.String temporaryDirectory, int attempts, long pause, java.util.concurrent.TimeUnit timeUnit)Creates a connection factory for creating a socket connection via a file.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description VirtualMachine.ForHotSpot.Connectionconnect(java.lang.String processId)Connects to the supplied process.protected abstract VirtualMachine.ForHotSpot.ConnectiondoConnect(java.io.File socket)Connects to the supplied POSIX socket.protected abstract voidkill(java.lang.String processId, int signal)Sends a kill signal to the target process.
-
-
-
Field Detail
-
SOCKET_FILE_PREFIX
private static final java.lang.String SOCKET_FILE_PREFIX
The name prefix for a socket.- See Also:
- Constant Field Values
-
ATTACH_FILE_PREFIX
private static final java.lang.String ATTACH_FILE_PREFIX
The name prefix for an attachment file indicator.- See Also:
- Constant Field Values
-
temporaryDirectory
private final java.lang.String temporaryDirectory
The temporary directory to use.
-
attempts
private final int attempts
The maximum amount of attempts for checking the establishment of a socket connection.
-
pause
private final long pause
The pause between two checks for an established socket connection.
-
timeUnit
private final java.util.concurrent.TimeUnit timeUnit
The time unit of the pause time.
-
-
Constructor Detail
-
ForSocketFile
protected ForSocketFile(java.lang.String temporaryDirectory, int attempts, long pause, java.util.concurrent.TimeUnit timeUnit)Creates a connection factory for creating a socket connection via a file.- Parameters:
temporaryDirectory- The temporary directory to use.attempts- The maximum amount of attempts for checking the establishment of a socket connection.pause- The pause between two checks for an established socket connection.timeUnit- The time unit of the pause time.
-
-
Method Detail
-
connect
public VirtualMachine.ForHotSpot.Connection connect(java.lang.String processId) throws java.io.IOException
Connects to the supplied process.- Specified by:
connectin interfaceVirtualMachine.ForHotSpot.Connection.Factory- Parameters:
processId- The process id.- Returns:
- The connection to the virtual machine with the supplied process id.
- Throws:
java.io.IOException- If an I/O exception occurs during connecting to the targeted VM.
-
kill
protected abstract void kill(java.lang.String processId, int signal)Sends a kill signal to the target process.- Parameters:
processId- The process id.signal- The signal to send.
-
doConnect
protected abstract VirtualMachine.ForHotSpot.Connection doConnect(java.io.File socket) throws java.io.IOException
Connects to the supplied POSIX socket.- Parameters:
socket- The socket to connect to.- Returns:
- An active connection to the supplied socket.
- Throws:
java.io.IOException- If an error occurs during connection.
-
-