Class AbstractBaseCommand
java.lang.Object
org.jolokia.jvmagent.client.command.AbstractBaseCommand
- Direct Known Subclasses:
EncryptCommand,HelpCommand,ListCommand,StartCommand,StatusCommand,StopCommand,ToggleCommand,VersionCommand
Stateless Base command providing helper functions
- Since:
- 06.10.11
- Author:
- roland
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcheckAgentUrl(Object pVm, VirtualMachineHandlerOperations pHandler) Check whether an agent is registered by checking the existance of the system propertyJvmAgent.JOLOKIA_AGENT_URL.protected StringcheckAgentUrl(Object pVm, VirtualMachineHandlerOperations pHandler, int delayInMs) Check whether an agent is registered by checking the existance of the system propertyJvmAgent.JOLOKIA_AGENT_URL.protected PropertiesgetAgentSystemProperties(Object pVm, VirtualMachineHandlerOperations pHandler) ExecuteVirtualMachine.getSystemProperties()via reflectionprotected StringgetProcessDescription(VirtualMachineHandlerOperations pHandler, OptionsAndArgs pOpts) Get a description of the process attached, either the numeric id only or, if a pattern is given, the pattern and the associated PIDprotected voidloadAgent(Object pVm, VirtualMachineHandlerOperations pHandler, OptionsAndArgs pOpts, String... pAdditionalOpts) Executecom.sun.tools.attach.VirtualMachine#loadAgent(String, String)
-
Constructor Details
-
AbstractBaseCommand
public AbstractBaseCommand()
-
-
Method Details
-
loadAgent
protected void loadAgent(Object pVm, VirtualMachineHandlerOperations pHandler, OptionsAndArgs pOpts, String... pAdditionalOpts) Executecom.sun.tools.attach.VirtualMachine#loadAgent(String, String)- Parameters:
pVm- the VirtualMachine object, typelesspHandler- platform-specific way to invoke operations on VMpOpts- options from where to extract the agent path and optionspAdditionalOpts- optional additional options to be appended to the agent options. Must be a CSV string.
-
checkAgentUrl
Check whether an agent is registered by checking the existance of the system propertyJvmAgent.JOLOKIA_AGENT_URL. This can be used to check, whether a Jolokia agent has been already attached and started. ("start" will set this property, "stop" will remove it).- Parameters:
pVm- theVirtualMachine, but typelesspHandler- platform-specific way to invoke operations on VM- Returns:
- the agent URL if it was set by a previous 'start' command.
-
checkAgentUrl
Check whether an agent is registered by checking the existance of the system propertyJvmAgent.JOLOKIA_AGENT_URL. This can be used to check, whether a Jolokia agent has been already attached and started. ("start" will set this property, "stop" will remove it).- Parameters:
pVm- theVirtualMachine, but typelesspHandler- platform-specific way to invoke operations on VMdelayInMs- wait that many ms before fetching the properties- Returns:
- the agent URL if it was set by a previous 'start' command.
-
getAgentSystemProperties
ExecuteVirtualMachine.getSystemProperties()via reflection- Parameters:
pVm- the VirtualMachine object, typelesspHandler- platform-specific way to invoke operations on VM- Returns:
- the system properties
-
getProcessDescription
protected String getProcessDescription(VirtualMachineHandlerOperations pHandler, OptionsAndArgs pOpts) Get a description of the process attached, either the numeric id only or, if a pattern is given, the pattern and the associated PID- Parameters:
pHandler- handler for looking up the process in case of a pattern lookuppOpts- options from where to take the PID or pattern- Returns:
- a description of the process
-