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 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
FieldsModifier and TypeFieldDescriptionprivate static final String
The name prefix for an attachment file indicator.private final int
The maximum amount of attempts for checking the establishment of a socket connection.private final long
The pause between two checks for an established socket connection.private static final String
The name prefix for a socket.private final String
The temporary directory to use.private final TimeUnit
The time unit of the pause time. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ForSocketFile
(String temporaryDirectory, int attempts, long pause, TimeUnit timeUnit) Creates a connection factory for creating a socket connection via a file. -
Method Summary
Modifier and TypeMethodDescriptionConnects to the supplied process.protected abstract VirtualMachine.ForHotSpot.Connection
Connects to the supplied POSIX socket.protected abstract void
Sends a kill signal to the target process.
-
Field Details
-
SOCKET_FILE_PREFIX
The name prefix for a socket.- See Also:
-
ATTACH_FILE_PREFIX
The name prefix for an attachment file indicator.- See Also:
-
temporaryDirectory
The temporary directory to use. -
attempts
private final int attemptsThe maximum amount of attempts for checking the establishment of a socket connection. -
pause
private final long pauseThe pause between two checks for an established socket connection. -
timeUnit
The time unit of the pause time.
-
-
Constructor Details
-
ForSocketFile
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 Details
-
connect
Connects to the supplied process.- Specified by:
connect
in interfaceVirtualMachine.ForHotSpot.Connection.Factory
- Parameters:
processId
- The process id.- Returns:
- The connection to the virtual machine with the supplied process id.
- Throws:
IOException
- If an I/O exception occurs during connecting to the targeted VM.
-
kill
Sends a kill signal to the target process.- Parameters:
processId
- The process id.signal
- The signal to send.
-
doConnect
Connects to the supplied POSIX socket.- Parameters:
socket
- The socket to connect to.- Returns:
- An active connection to the supplied socket.
- Throws:
IOException
- If an error occurs during connection.
-