public class Controller extends Object
This Controller
class is used to interact with a Manager
MBean running inside an OpenNMS JMX service. This class can invoke operations
on that MBean and request status information from it. It is used to execute
shell operations to control the lifecycle of the OpenNMS process from init.d
or systemd scripts.
Modifier and Type | Field and Description |
---|---|
static String |
CONNECTOR_ADDRESS
The system property used to determine the JMX management agent URI for the
JVM that we are attaching to.
|
static String |
DEFAULT_JMX_RMI_URL |
Constructor and Description |
---|
Controller() |
Modifier and Type | Method and Description |
---|---|
int |
check()
check
|
Object |
doInvokeOperation(String operation) |
int |
dumpThreads()
dumpThreads
|
int |
exit()
exit
|
String |
getJmxUrl()
This method uses the Java Attach API to connect to a running OpenNMS JVM
and fetch the dynamically assigned local JMX agent URL.
|
String |
getPid() |
int |
getRmiHandshakeTimeout() |
int |
invokeOperation(String operation) |
boolean |
isVerbose()
isVerbose
|
static void |
main(String[] argv)
main
|
void |
setJmxRmiUrl(String jmxUrl)
setJmxRmiUrl
|
void |
setPid(String pid) |
void |
setRmiHandshakeTimeout(int httpRequestReadTimeout) |
void |
setVerbose(boolean verbose)
setVerbose
|
void |
start()
Start the OpenNMS daemon.
|
int |
status()
status
|
int |
stop()
stop
|
public static final String CONNECTOR_ADDRESS
https://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html
,
Constant Field Valuespublic static final String DEFAULT_JMX_RMI_URL
public void start()
public int stop()
stop
public int status()
status
public int check()
check
public int dumpThreads()
dumpThreads
public int exit()
exit
public int invokeOperation(String operation)
public Object doInvokeOperation(String operation) throws MalformedURLException, IOException, InstanceNotFoundException, MalformedObjectNameException, MBeanException, ReflectionException, NullPointerException
public boolean isVerbose()
isVerbose
public void setVerbose(boolean verbose)
setVerbose
verbose
- a boolean.public String getJmxUrl()
String
object.https://docs.oracle.com/javase/8/docs/jdk/api/attach/spec/index.html
,
https://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html
public void setJmxRmiUrl(String jmxUrl)
setJmxRmiUrl
jmxUrl
- a String
object.public String getPid()
public void setPid(String pid)
public int getRmiHandshakeTimeout()
public void setRmiHandshakeTimeout(int httpRequestReadTimeout)
Copyright © 2021. All rights reserved.