public class JmxClient extends Object implements Closeable
Constructor and Description |
---|
JmxClient(InetAddress address,
int port)
Connect the client to an address and port combination.
|
JmxClient(int localPort)
Connect the client to the local host at a certain port number.
|
JmxClient(String jmxUrl)
Connect the client to a JMX server using the full JMX URL format.
|
JmxClient(String hostName,
int port)
Connect the client to a host and port combination.
|
JmxClient(String hostName,
int port,
Map<String,Object> environment)
Connect the client to a host and port combination.
|
JmxClient(String hostName,
int port,
String userName,
String password)
Connect the client to a host and port combination and a username and password.
|
JmxClient(String jmxUrl,
Map<String,Object> environmentMap)
Connect the client to a JMX server using the full JMX URL format an environment-map passed into
JMXConnectorFactory.connect(JMXServiceURL, Map) . |
JmxClient(String jmxUrl,
String userName,
String password)
Connect the client to a JMX server using the full JMX URL format with username/password credentials.
|
JmxClient(String jmxUrl,
String userName,
String password,
Map<String,Object> environmentMap)
Connect the client to a JMX server using the full JMX URL format with username/password credentials.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the client connection to the mbean server.If you want a method that throws then use
closeThrow() . |
void |
closeThrow()
Close the client connection to the mbean server.
|
static String |
generalJmxUrlForHostNamePort(String hostName,
int port)
Returns a JMX/RMI URL for a host-name and port.
|
Object |
getAttribute(ObjectName name,
String attributeName)
Return the value of a JMX attribute.
|
Object |
getAttribute(String domain,
String beanName,
String attributeName)
Return the value of a JMX attribute.
|
MBeanAttributeInfo |
getAttributeInfo(ObjectName name,
String attrName)
Return information for a particular attribute name.
|
List<Attribute> |
getAttributes(ObjectName name,
String[] attributes)
Get multiple attributes at once from the server.
|
List<Attribute> |
getAttributes(String domain,
String beanName,
String[] attributes)
Get multiple attributes at once from the server.
|
MBeanAttributeInfo[] |
getAttributesInfo(ObjectName name)
Return an array of the attributes associated with the bean name.
|
MBeanAttributeInfo[] |
getAttributesInfo(String domainName,
String beanName)
Return an array of the attributes associated with the bean name.
|
String |
getAttributeString(ObjectName name,
String attributeName)
Return the value of a JMX attribute as a String or null if attribute has a null value.
|
String |
getAttributeString(String domain,
String beanName,
String attributeName)
Return the value of a JMX attribute as a String.
|
String[] |
getBeanDomains()
Return an array of the bean's domain names.
|
Set<ObjectName> |
getBeanNames()
Return a set of the various bean ObjectName objects associated with the Jmx server.
|
Set<ObjectName> |
getBeanNames(String domain)
Return a set of the various bean ObjectName objects associated with the Jmx server.
|
MBeanOperationInfo |
getOperationInfo(ObjectName name,
String oper)
Return an array of the operations associated with the bean name.
|
MBeanOperationInfo[] |
getOperationsInfo(ObjectName name)
Return an array of the operations associated with the bean name.
|
MBeanOperationInfo[] |
getOperationsInfo(String domainName,
String beanName)
Return an array of the operations associated with the bean name.
|
Object |
invokeOperation(ObjectName objectName,
String operName,
Object... params)
Invoke a JMX method as an array of objects.
|
Object |
invokeOperation(ObjectName name,
String operName,
String... paramStrings)
Invoke a JMX method as an array of parameter strings.
|
Object |
invokeOperation(String domain,
String beanName,
String operName,
Object... params)
Invoke a JMX method as an array of objects.
|
Object |
invokeOperation(String domain,
String beanName,
String operName,
String... paramStrings)
Invoke a JMX method with a domain/object-name as an array of parameter strings.
|
String |
invokeOperationToString(ObjectName name,
String operName,
String... paramStrings)
Invoke a JMX method as an array of parameter strings.
|
void |
setAttribute(ObjectName name,
String attrName,
Object value)
Set the JMX attribute to a particular value.
|
void |
setAttribute(ObjectName name,
String attrName,
String value)
Set the JMX attribute to a particular value string.
|
void |
setAttribute(String domainName,
String beanName,
String attrName,
Object value)
Set the JMX attribute to a particular value string.
|
void |
setAttribute(String domainName,
String beanName,
String attrName,
String value)
Set the JMX attribute to a particular value string.
|
void |
setAttributes(ObjectName name,
List<Attribute> attributes)
Set a multiple attributes at once on the server.
|
void |
setAttributes(String domainName,
String beanName,
List<Attribute> attributes)
Set a multiple attributes at once on the server.
|
public JmxClient(String jmxUrl) throws JMException
Connect the client to a JMX server using the full JMX URL format. The URL should look something like:
service:jmx:rmi:///jndi/rmi://hostName:portNumber/jmxrmi
JMException
public JmxClient(String jmxUrl, String userName, String password) throws JMException
Connect the client to a JMX server using the full JMX URL format with username/password credentials. The URL should look something like:
service:jmx:rmi:///jndi/rmi://hostName:portNumber/jmxrmi
JMException
public JmxClient(String jmxUrl, String userName, String password, Map<String,Object> environmentMap) throws JMException
Connect the client to a JMX server using the full JMX URL format with username/password credentials. The URL should look something like:
service:jmx:rmi:///jndi/rmi://hostName:portNumber/jmxrmi
JMException
public JmxClient(int localPort) throws JMException
JMException
public JmxClient(String hostName, int port) throws JMException
JMException
public JmxClient(String hostName, int port, String userName, String password) throws JMException
JMException
public JmxClient(String hostName, int port, Map<String,Object> environment) throws JMException
JMException
public JmxClient(InetAddress address, int port) throws JMException
JMException
public JmxClient(String jmxUrl, Map<String,Object> environmentMap) throws JMException
Connect the client to a JMX server using the full JMX URL format an environment-map passed into
JMXConnectorFactory.connect(JMXServiceURL, Map)
. The URL should look something like:
service:jmx:rmi:///jndi/rmi://hostName:portNumber/jmxrmi
JMException
public static String generalJmxUrlForHostNamePort(String hostName, int port)
public void close()
closeThrow()
.close
in interface Closeable
close
in interface AutoCloseable
public void closeThrow() throws JMException
close()
.JMException
public String[] getBeanDomains() throws JMException
JMException
public Set<ObjectName> getBeanNames() throws JMException
JMException
public Set<ObjectName> getBeanNames(String domain) throws JMException
JMException
public MBeanAttributeInfo[] getAttributesInfo(String domainName, String beanName) throws JMException
JMException
public MBeanAttributeInfo[] getAttributesInfo(ObjectName name) throws JMException
JMException
public MBeanAttributeInfo getAttributeInfo(ObjectName name, String attrName) throws JMException
JMException
public MBeanOperationInfo[] getOperationsInfo(String domainName, String beanName) throws JMException
JMException
public MBeanOperationInfo[] getOperationsInfo(ObjectName name) throws JMException
JMException
public MBeanOperationInfo getOperationInfo(ObjectName name, String oper) throws JMException
JMException
public Object getAttribute(String domain, String beanName, String attributeName) throws Exception
Exception
public Object getAttribute(ObjectName name, String attributeName) throws Exception
Exception
public String getAttributeString(String domain, String beanName, String attributeName) throws Exception
Exception
public String getAttributeString(ObjectName name, String attributeName) throws Exception
Exception
public List<Attribute> getAttributes(ObjectName name, String[] attributes) throws Exception
Exception
public List<Attribute> getAttributes(String domain, String beanName, String[] attributes) throws Exception
Exception
public void setAttribute(String domainName, String beanName, String attrName, String value) throws Exception
Exception
public void setAttribute(ObjectName name, String attrName, String value) throws Exception
Exception
public void setAttribute(String domainName, String beanName, String attrName, Object value) throws Exception
Exception
public void setAttribute(ObjectName name, String attrName, Object value) throws Exception
Exception
public void setAttributes(ObjectName name, List<Attribute> attributes) throws Exception
Exception
public void setAttributes(String domainName, String beanName, List<Attribute> attributes) throws Exception
Exception
public Object invokeOperation(String domain, String beanName, String operName, String... paramStrings) throws Exception
Exception
public Object invokeOperation(ObjectName name, String operName, String... paramStrings) throws Exception
Exception
public String invokeOperationToString(ObjectName name, String operName, String... paramStrings) throws Exception
Exception
public Object invokeOperation(String domain, String beanName, String operName, Object... params) throws Exception
Exception
This documentation content is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.