Package com.attivio.util
Class JmxUtils
- java.lang.Object
-
- com.attivio.util.JmxUtils
-
- Direct Known Subclasses:
JMXUtils
public class JmxUtils extends java.lang.ObjectSet of base-level JMX utilities needed for remote JMX invocation
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringATTIVIO_ADMIN_DOMAINOur JMX Domain for admin components.static java.lang.StringOBJECT_NAME_FORMATThe format string for all Admin MBeans.static java.lang.StringSYSTEM_PROPERTY_JMX_AUTHENTICATEThe system property to determine whether authentication is enabled on jmxstatic java.lang.StringSYSTEM_PROPERTY_JMX_PORTThe system property to specify the port on which JMX should runstatic java.lang.StringSYSTEM_PROPERTY_JMX_SSLThe system property to determine whether ssl is enabled on jmx
-
Constructor Summary
Constructors Constructor Description JmxUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javax.management.remote.JMXConnectorconnectToRemoteServer(java.lang.String host, int port)Connects to an unauthenticated jmx server.static javax.management.remote.JMXConnectorconnectToRemoteServer(java.lang.String host, int port, java.lang.String userName, java.lang.String password)Creates a JMXConnector connected to the remote host and port.static javax.management.remote.JMXConnectorconnectToRemoteServer(java.lang.String host, int port, java.lang.String userName, java.lang.String password, boolean useJmxMp)Creates a JMXConnector connected to the remote host and port.static javax.management.ObjectNamegetAdminObjectName(java.lang.Class<?> apiClass)Gets the JMXObjectNameforapiClass.static javax.management.ObjectNamegetAdminObjectName(java.lang.Class<?> apiClass, java.lang.String name)Gets the JMXObjectNameforapiClass.static <T> TgetRemoteJmxApi(java.lang.Class<T> clazz, java.lang.String host, int remotePort)static <T> TgetRemoteJmxApi(java.lang.Class<T> clazz, java.lang.String host, int remotePort, java.lang.String username, java.lang.String password)static <T> TgetRemoteProxy(RemoteJmxEndpoint endpoint, java.lang.Class<T> clazz)Returns a proxy to the remote instance of the API described byendpoint.
-
-
-
Field Detail
-
ATTIVIO_ADMIN_DOMAIN
public static final java.lang.String ATTIVIO_ADMIN_DOMAIN
Our JMX Domain for admin components.- See Also:
- Constant Field Values
-
OBJECT_NAME_FORMAT
public static final java.lang.String OBJECT_NAME_FORMAT
The format string for all Admin MBeans.- See Also:
- Constant Field Values
-
SYSTEM_PROPERTY_JMX_AUTHENTICATE
public static final java.lang.String SYSTEM_PROPERTY_JMX_AUTHENTICATE
The system property to determine whether authentication is enabled on jmx- See Also:
- Constant Field Values
-
SYSTEM_PROPERTY_JMX_SSL
public static final java.lang.String SYSTEM_PROPERTY_JMX_SSL
The system property to determine whether ssl is enabled on jmx- See Also:
- Constant Field Values
-
SYSTEM_PROPERTY_JMX_PORT
public static final java.lang.String SYSTEM_PROPERTY_JMX_PORT
The system property to specify the port on which JMX should run- See Also:
- Constant Field Values
-
-
Method Detail
-
getRemoteJmxApi
public static final <T> T getRemoteJmxApi(java.lang.Class<T> clazz, java.lang.String host, int remotePort) throws AttivioException- Parameters:
clazz- an ExposedApi implementationhost- the host name where the jmx mbean residesremotePort- of the node- Returns:
- A remote proxy to the exposed api
- Throws:
AttivioException
-
getRemoteJmxApi
public static final <T> T getRemoteJmxApi(java.lang.Class<T> clazz, java.lang.String host, int remotePort, java.lang.String username, java.lang.String password) throws AttivioException- Throws:
AttivioException
-
getAdminObjectName
public static javax.management.ObjectName getAdminObjectName(java.lang.Class<?> apiClass) throws javax.management.MalformedObjectNameException, java.lang.NullPointerExceptionGets the JMXObjectNameforapiClass. Presumes only a single object of this class will be registered.- Parameters:
apiClass- the registered class, generally anExposedApi.- Throws:
javax.management.MalformedObjectNameExceptionjava.lang.NullPointerException
-
getAdminObjectName
public static javax.management.ObjectName getAdminObjectName(java.lang.Class<?> apiClass, java.lang.String name) throws javax.management.MalformedObjectNameException, java.lang.NullPointerExceptionGets the JMXObjectNameforapiClass.- Parameters:
apiClass- the registered class, generally anExposedApiname- detail name if more than one of these gets exposed- Throws:
javax.management.MalformedObjectNameExceptionjava.lang.NullPointerException
-
getRemoteProxy
public static final <T> T getRemoteProxy(RemoteJmxEndpoint endpoint, java.lang.Class<T> clazz) throws java.io.IOException
Returns a proxy to the remote instance of the API described byendpoint. The endpoint is expected to represent an API of the typeclazz.This method uses system property
#JMX_AUTH_USERNAMEand#JMX_AUTH_PASSWORDto authenticate when specified.- Parameters:
endpoint-clazz-- Returns:
- Throws:
java.io.IOException
-
connectToRemoteServer
public static javax.management.remote.JMXConnector connectToRemoteServer(java.lang.String host, int port, java.lang.String userName, java.lang.String password) throws java.io.IOExceptionCreates a JMXConnector connected to the remote host and port. The port must be for a remote JMX listener. This listener is typically set to be the baseport of the AIE instance plusDefaultEndpoints.Ports.REMOTE_JMX_PORT_OFFSET. The typical use case will be to callJMXConnector.getMBeanServerConnection(), use the returned value, then callJMXConnector.close()when finished.- Parameters:
host-port-- Returns:
- a JMXConnector connected to the remote host and port.
- Throws:
java.io.IOException
-
connectToRemoteServer
public static javax.management.remote.JMXConnector connectToRemoteServer(java.lang.String host, int port, java.lang.String userName, java.lang.String password, boolean useJmxMp) throws java.io.IOExceptionCreates a JMXConnector connected to the remote host and port. The port must be for a remote JMX listener. This listener is typically set to be the baseport of the AIE instance plusDefaultEndpoints.Ports.REMOTE_JMX_PORT_OFFSET. The typical use case will be to callJMXConnector.getMBeanServerConnection(), use the returned value, then callJMXConnector.close()when finished.- Parameters:
host-port-- Returns:
- a JMXConnector connected to the remote host and port.
- Throws:
java.io.IOException
-
connectToRemoteServer
public static javax.management.remote.JMXConnector connectToRemoteServer(java.lang.String host, int port) throws java.io.IOExceptionConnects to an unauthenticated jmx server.- Parameters:
host-port-- Throws:
java.io.IOException
-
-