Package org.jolokia.jvmagent.client.util
Interface VirtualMachineHandlerOperations
public interface VirtualMachineHandlerOperations
A contract for dealing with VirtualMachine on any JDK where
Attach API is supported.
The virtual machine is passed as Object and dealt with differently in chosen implementation of the
contract.
- Since:
- 24.06.2021
- Author:
- ggrzybek
-
Method Summary
Modifier and TypeMethodDescriptionLookup and create acom.sun.tools.attach.VirtualMachinevoiddetachAgent(Object pVm) Detach from the virtual machinefindProcess(Pattern pPattern) Filter the process list for a regular expression and returns the description.Returns system properties from attached VM.Return a list of all Java processesvoidLoads Jolokia agent into the attached VM.
-
Method Details
-
attachVirtualMachine
Lookup and create acom.sun.tools.attach.VirtualMachine- Returns:
- the virtual machine of
nullif none could be created - Throws:
ProcessingException- for any problem related to VM attaching. Specific to particular implementation.
-
detachAgent
Detach from the virtual machine- Parameters:
pVm- the virtual machine to detach from- Throws:
ProcessingException- for any problem related to VM detaching. Specific to particular implementation.
-
listProcesses
List<ProcessDescription> listProcesses()Return a list of all Java processes- Returns:
- list of java processes
-
findProcess
Filter the process list for a regular expression and returns the description. The process this JVM is running in is ignored. If more than one process or no process is found, an exception is raised.- Parameters:
pPattern- regular expression to match- Returns:
- a process description of the one process found but never null
- Throws:
IllegalArgumentException- if more than one or no process has been found.
-
loadAgent
Loads Jolokia agent into the attached VM.- Parameters:
pVm-VirtualMachineaccess objectjarFilePath- path to Java agent JAR fileargs- arguments toVirtualMachine.loadAgent(String, String)method
-
getSystemProperties
Returns system properties from attached VM.- Parameters:
pVm-VirtualMachineaccess object- Returns:
- system properties of the remote VM
-