Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
log
The logger.
|
Modifier and Type | Method and Description |
---|---|
static Object |
executeCommand(JMXConnector connector,
String beanName,
String command,
String... arguments)
Execute a single command, closing the connector afterwards.
|
static Object |
executeCommand(MBeanServerConnection connection,
String beanName,
String command,
String... arguments)
Execute a command on a bean.
|
static Object |
getAttribute(JMXConnector connector,
String beanName,
String attribute)
Get the value of an attribute, closing the connector afterwards.
|
static Object |
getAttribute(String beanName,
String attribute,
MBeanServerConnection connection)
Get the value of an attribute from a bean.
|
static ObjectName |
getBeanName(String beanName)
Get a bean name from a string version.
|
static JMXConnector |
getJMXConnector(String hostName,
int jmxPort,
String login,
String password)
Get a JMXConnector to a given host and port, using login and password.
|
static long |
getJmxTimeout() |
static int |
getMaxTries()
The maximum number of times we back off on getting an mbean or a job.
|
static MBeanServerConnection |
getMBeanServerConnection(JMXServiceURL url,
Map<String,String[]> credentials)
Connects to the given (url-specified) service point, sending the given credentials as login.
|
static MBeanServerConnection |
getMBeanServerConnection(String server,
int jmxPort,
int rmiPort,
String userName,
String password)
Returns a connection to a remote MbeanServer defined by the given arguments.
|
static CompositeData |
getOneCompositeData(TabularData items)
Get a single CompositeData object out of a TabularData structure.
|
static JMXServiceURL |
getUrl(String server,
int jmxPort,
int rmiPort)
Constructs the same service URL that JConsole does on the basis of a server name, a JMX port number, and a RMI
port number.
|
static Map<String,String[]> |
packageCredentials(String userName,
String password)
Packages credentials as an environment for JMX connections.
|
public static final org.slf4j.Logger log
public static int getMaxTries()
public static long getJmxTimeout()
public static JMXServiceURL getUrl(String server, int jmxPort, int rmiPort)
Example URL: service:jmx:rmi://0.0.0.0:9999/jndi/rmi://0.0.0.0:1099/JMXConnector where RMI port number = 9999, JMX port number = 1099 server = 0.0.0.0 a.k.a localhost(?).
server
- The server that should be connected to using the constructed URL.jmxPort
- The number of the JMX port that should be connected to using the constructed URL (may not be a
negative number)rmiPort
- The number of the RMI port that should be connected to using the constructed URL, or -1 if the
default RMI port should be used.public static MBeanServerConnection getMBeanServerConnection(String server, int jmxPort, int rmiPort, String userName, String password)
server
- the remote servernamejmxPort
- the remote jmx-portrmiPort
- the remote rmi-portuserName
- the usernamepassword
- the passwordpublic static MBeanServerConnection getMBeanServerConnection(JMXServiceURL url, Map<String,String[]> credentials)
url
- The JMX service url of some JVM on some machine.credentials
- a map with (at least) one entry, mapping "jmx.remote.credentials" to a String array of length
2. Its first item should be the user name. Its second item should be the password.public static Map<String,String[]> packageCredentials(String userName, String password)
userName
- The user to login aspassword
- The password to use for that userpublic static Object executeCommand(MBeanServerConnection connection, String beanName, String command, String... arguments)
connection
- Connection to the server holding the bean.beanName
- Name of the bean.command
- Command to execute.arguments
- Arguments to the command. Only string arguments are possible at the moment.public static Object getAttribute(String beanName, String attribute, MBeanServerConnection connection)
beanName
- Name of the bean to get an attribute for.attribute
- Name of the attribute to get.connection
- A connection to the JMX server for the bean.public static ObjectName getBeanName(String beanName)
beanName
- String representation of bean namepublic static JMXConnector getJMXConnector(String hostName, int jmxPort, String login, String password)
hostName
- The host to attempt to connect to.jmxPort
- The port on the host to connect to (a non-negative number).login
- The login name to authenticate as (typically "controlRole" or "monitorRole".password
- The password for JMX access.IOFailure
- if connecting to JMX fails.public static CompositeData getOneCompositeData(TabularData items)
items
- TabularData structure as returned from JMX calls.ArgumentNotValid
- if there is not exactly one item in items, or items is null.public static Object executeCommand(JMXConnector connector, String beanName, String command, String... arguments)
connector
- A one-shot connector object.beanName
- The name of the bean to execute a command on.command
- The command to execute.arguments
- The arguments to the command (all strings)public static Object getAttribute(JMXConnector connector, String beanName, String attribute)
connector
- A one-shot connector object.beanName
- The name of the bean to get an attribute from.attribute
- The attribute to get.Copyright © 2005–2015 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.