Class JmxClient
java.lang.Object
com.j256.simplejmx.client.JmxClient
- All Implemented Interfaces:
Closeable, AutoCloseable
-
Constructor Summary
ConstructorsConstructorDescriptionJmxClient(int localPort) Connect the client to the local host at a certain port number.Connect the client to a JMX server using the full JMX URL format.Connect the client to a host and port combination.Connect the client to a host and port combination and a username and password.Connect the client to a host and port combination.Connect the client to a JMX server using the full JMX URL format with username/password credentials.Connect the client to a JMX server using the full JMX URL format with username/password credentials.Connect the client to a JMX server using the full JMX URL format an environment-map passed intoJMXConnectorFactory.connect(JMXServiceURL, Map).JmxClient(InetAddress address, int port) Connect the client to an address and port combination. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the client connection to the mbean server.If you want a method that throws then usecloseThrow().voidClose the client connection to the mbean server.static StringgeneralJmxUrlForHostNamePort(String hostName, int port) Returns a JMX/RMI URL for a host-name and port.getAttribute(String domain, String beanName, String attributeName) Return the value of a JMX attribute.getAttribute(ObjectName name, String attributeName) Return the value of a JMX attribute.getAttributeInfo(ObjectName name, String attrName) Return information for a particular attribute name.getAttributes(String domain, String beanName, String[] attributes) Get multiple attributes at once from the server.getAttributes(ObjectName name, String[] attributes) Get multiple attributes at once from the server.getAttributesInfo(String domainName, String beanName) Return an array of the attributes associated with the bean name.getAttributesInfo(ObjectName name) Return an array of the attributes associated with the bean name.getAttributeString(String domain, String beanName, String attributeName) Return the value of a JMX attribute as a 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[]Return an array of the bean's domain names.Return a set of the various bean ObjectName objects associated with the Jmx server.getBeanNames(String domain) Return a set of the various bean ObjectName objects associated with the Jmx server.getOperationInfo(ObjectName name, String oper) Return an array of the operations associated with the bean name.getOperationsInfo(String domainName, String beanName) Return an array of the operations associated with the bean name.getOperationsInfo(ObjectName name) Return an array of the operations associated with the bean name.invokeOperation(String domain, String beanName, String operName, Object... params) Invoke a JMX method as an array of objects.invokeOperation(String domain, String beanName, String operName, String... paramStrings) Invoke a JMX method with a domain/object-name as an array of parameter strings.invokeOperation(ObjectName objectName, String operName, Object... params) Invoke a JMX method as an array of objects.invokeOperation(ObjectName name, String operName, String... paramStrings) Invoke a JMX method as an array of parameter strings.invokeOperationToString(ObjectName name, String operName, String... paramStrings) Invoke a JMX method as an array of parameter strings.voidsetAttribute(String domainName, String beanName, String attrName, Object value) Set the JMX attribute to a particular value string.voidsetAttribute(String domainName, String beanName, String attrName, String value) Set the JMX attribute to a particular value string.voidsetAttribute(ObjectName name, String attrName, Object value) Set the JMX attribute to a particular value.voidsetAttribute(ObjectName name, String attrName, String value) Set the JMX attribute to a particular value string.voidsetAttributes(String domainName, String beanName, List<Attribute> attributes) Set a multiple attributes at once on the server.voidsetAttributes(ObjectName name, List<Attribute> attributes) Set a multiple attributes at once on the server.
-
Constructor Details
-
JmxClient
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
- Throws:
JMException
-
JmxClient
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
- Throws:
JMException
-
JmxClient
public JmxClient(String jmxUrl, String userName, String password, Map<String, Object> environmentMap) throws JMExceptionConnect 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
- Throws:
JMException
-
JmxClient
Connect the client to the local host at a certain port number.- Throws:
JMException
-
JmxClient
Connect the client to a host and port combination.- Throws:
JMException
-
JmxClient
Connect the client to a host and port combination and a username and password.- Throws:
JMException
-
JmxClient
Connect the client to a host and port combination.- Throws:
JMException
-
JmxClient
Connect the client to an address and port combination.- Throws:
JMException
-
JmxClient
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
- Throws:
JMException
-
-
Method Details
-
generalJmxUrlForHostNamePort
-
close
public void close()Close the client connection to the mbean server.If you want a method that throws then usecloseThrow().- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
closeThrow
Close the client connection to the mbean server. If you want a method that does not throw then useclose().- Throws:
JMException
-
getBeanDomains
Return an array of the bean's domain names.- Throws:
JMException
-
getBeanNames
Return a set of the various bean ObjectName objects associated with the Jmx server.- Throws:
JMException
-
getBeanNames
Return a set of the various bean ObjectName objects associated with the Jmx server.- Throws:
JMException
-
getAttributesInfo
public MBeanAttributeInfo[] getAttributesInfo(String domainName, String beanName) throws JMException Return an array of the attributes associated with the bean name.- Throws:
JMException
-
getAttributesInfo
Return an array of the attributes associated with the bean name.- Throws:
JMException
-
getAttributeInfo
Return information for a particular attribute name.- Throws:
JMException
-
getOperationsInfo
public MBeanOperationInfo[] getOperationsInfo(String domainName, String beanName) throws JMException Return an array of the operations associated with the bean name.- Throws:
JMException
-
getOperationsInfo
Return an array of the operations associated with the bean name.- Throws:
JMException
-
getOperationInfo
Return an array of the operations associated with the bean name.- Throws:
JMException
-
getAttribute
-
getAttribute
Return the value of a JMX attribute.- Throws:
Exception
-
getAttributeString
-
getAttributeString
Return the value of a JMX attribute as a String or null if attribute has a null value.- Throws:
Exception
-
getAttributes
-
getAttributes
-
setAttribute
-
setAttribute
Set the JMX attribute to a particular value string.- Throws:
Exception
-
setAttribute
-
setAttribute
Set the JMX attribute to a particular value.- Throws:
Exception
-
setAttributes
Set a multiple attributes at once on the server.- Throws:
Exception
-
setAttributes
-
invokeOperation
-
invokeOperation
-
invokeOperationToString
-
invokeOperation
-
invokeOperation
-