|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.continuent.tungsten.common.jmx.JmxManager
public class JmxManager
Encapsulates JMX server start/stop and provides static utility methods to register MBeans on the server side as well as get proxies for them on the client side.
| Field Summary | |
|---|---|
static java.lang.String |
CREATE_MBEAN_HELPER
|
protected javax.management.remote.JMXConnectorServer |
jmxConnectorServer
|
protected java.rmi.registry.Registry |
rmiRegistry
|
| Constructor Summary | |
|---|---|
JmxManager(java.lang.String host,
int beanPort,
int registryPort,
java.lang.String serviceName)
Creates an instance to manage a JMX service |
|
JmxManager(java.lang.String host,
int registryPort,
java.lang.String serviceName)
Creates an instance to manage a JMX service |
|
JmxManager(java.lang.String host,
int registryPort,
java.lang.String serviceName,
TungstenProperties tungstenProperty)
Creates an instance to manage a JMX service Called when using authentication (and) encryption |
|
| Method Summary | |
|---|---|
static void |
addNotificationListener(javax.management.remote.JMXConnector jmxConnector,
java.lang.Class<?> mbeanClass,
javax.management.NotificationListener notificationListener)
Attach NotificationListener that can be used to listen notifications emitted by MBean server. |
static void |
addNotificationListener(javax.management.remote.JMXConnector jmxConnector,
java.lang.Class<?> mbeanInterface,
java.lang.String mbeanName,
javax.management.NotificationListener notificationListener,
boolean ignored)
Attach NotificationListener that can be used to listen notifications emitted by MBean server. |
static DynamicMBeanHelper |
createHelper(java.lang.Class<?> mbeanClass)
|
static DynamicMBeanHelper |
createHelper(java.lang.Class<?> mbeanClass,
java.lang.String alias)
|
protected void |
createRegistry(int port)
Starts the rmi registry. |
static javax.management.ObjectName |
generateMBeanObjectName(java.lang.Class<?> mbeanClass)
|
static javax.management.ObjectName |
generateMBeanObjectName(java.lang.String mbeanName,
java.lang.String typeName)
|
int |
getBeanPort()
|
static java.lang.String |
getHostName()
Get the hostname from the local host. |
static java.lang.Object |
getMBeanProxy(javax.management.remote.JMXConnector clientConnection,
java.lang.Class<?> mbeanClass,
boolean notificationBroadcaster)
Client helper method to obtain a proxy that implements the given interface by forwarding its methods through the given MBean server to the named MBean. |
static java.lang.Object |
getMBeanProxy(javax.management.remote.JMXConnector clientConnection,
java.lang.Class<?> mbeanClass,
java.lang.Class<?> mbeanInterface,
java.lang.String mbeanName,
boolean notificationBroadcaster,
boolean ignored)
Client helper method to obtain a proxy that implements the given interface by forwarding its methods through the given MBean server to the named MBean. |
static java.lang.Object |
getMBeanProxy(javax.management.remote.JMXConnector clientConnection,
java.lang.Class<?> mbeanClass,
java.lang.String mbeanName,
boolean notificationBroadcaster,
boolean ignored)
Client helper method to obtain a proxy that implements the given interface by forwarding its methods through the given MBean server to the named MBean. |
java.rmi.registry.Registry |
getRegistry()
|
static javax.management.remote.JMXConnector |
getRMIConnector(java.lang.String host,
int registryPort,
java.lang.String serviceName)
Client helper method to return an RMI connection. |
static javax.management.remote.JMXConnector |
getRMIConnector(java.lang.String host,
int registryPort,
java.lang.String serviceName,
TungstenProperties jmxProperties)
Client helper method to return an RMI connection. |
static javax.management.MBeanServerConnection |
getServerConnection(javax.management.remote.JMXConnector jmxConnector)
|
void |
handleNotification(javax.management.Notification notification,
java.lang.Object handback)
|
protected java.rmi.registry.Registry |
locateDefaultRegistry()
|
static void |
registerMBean(java.lang.Object mbean,
java.lang.Class<?> mbeanClass)
Server helper method to register a JMX MBean. |
static void |
registerMBean(java.lang.Object mbean,
java.lang.Class<?> mbeanInterface,
java.lang.String mbeanName,
boolean ignored)
Server helper method to register a JMX MBean. |
static void |
removeNotificationListener(javax.management.remote.JMXConnector jmxConnector,
java.lang.Class<?> mbeanClass,
javax.management.NotificationListener notificationListener)
Remove NotificationListener from this MBean. |
static void |
removeNotificationListener(javax.management.remote.JMXConnector jmxConnector,
java.lang.Class<?> mbeanInterface,
java.lang.String mbeanName,
javax.management.NotificationListener notificationListener,
boolean ignored)
Remove NotificationListener from this MBean. |
void |
start()
Starts the JXM server. |
protected void |
startJmxConnector()
Starts the JMX connector for the server. |
void |
stop()
Stops the JXM server. |
protected void |
stopJmxConnector()
Stops the JMX connector if it is running. |
protected void |
stopRMI()
Deallocates the RMI registry. |
static void |
unregisterMBean(java.lang.Class<?> mbeanInterface)
Server helper method to register a JMX MBean. |
static void |
unregisterMBean(java.lang.Class<?> mbeanInterface,
java.lang.String mbeanName)
Server helper method to register a JMX MBean. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.rmi.registry.Registry rmiRegistry
protected javax.management.remote.JMXConnectorServer jmxConnectorServer
public static final java.lang.String CREATE_MBEAN_HELPER
| Constructor Detail |
|---|
public JmxManager(java.lang.String host,
int beanPort,
int registryPort,
java.lang.String serviceName)
host - The host name or IP to usebeanPort - TODOregistryPort - The JMX server RMI registryPortserviceName - The JMX service name
public JmxManager(java.lang.String host,
int registryPort,
java.lang.String serviceName)
host - The host name or IP to useregistryPort - The JMX server RMI registryPortserviceName - The JMX service name
public JmxManager(java.lang.String host,
int registryPort,
java.lang.String serviceName,
TungstenProperties tungstenProperty)
host - registryPort - serviceName - tungstenProperty - | Method Detail |
|---|
public void start()
public void stop()
protected java.rmi.registry.Registry locateDefaultRegistry()
protected void createRegistry(int port)
protected void stopRMI()
protected void startJmxConnector()
protected void stopJmxConnector()
public static void registerMBean(java.lang.Object mbean,
java.lang.Class<?> mbeanInterface,
java.lang.String mbeanName,
boolean ignored)
mbean - The MBean instance that should be registeredmbeanInterface - The MBean interface this instance implementsmbeanName - A custom name for this MBean
ServerRuntimeException
public static void registerMBean(java.lang.Object mbean,
java.lang.Class<?> mbeanClass)
mbean - The MBean instance that should be registeredmbeanClass - The base class for the mbean
ServerRuntimeException
public static void unregisterMBean(java.lang.Class<?> mbeanInterface,
java.lang.String mbeanName)
mbeanInterface - The MBean interface this instance implementsmbeanName - A custom name for this MBean
ServerRuntimeExceptionpublic static void unregisterMBean(java.lang.Class<?> mbeanInterface)
mbeanInterface - The MBean interface this instance implements
ServerRuntimeException
public static javax.management.remote.JMXConnector getRMIConnector(java.lang.String host,
int registryPort,
java.lang.String serviceName)
host - the hostname to bind to in the jmx urlregistryPort - the registryPort number to bind to in the jmx urlserviceName - the JMX service name
public static javax.management.remote.JMXConnector getRMIConnector(java.lang.String host,
int registryPort,
java.lang.String serviceName,
TungstenProperties jmxProperties)
host - the hostname to bind to in the jmx urlregistryPort - the registryPort number to bind to in the jmx urlserviceName - the JMX service namejmxProperties - TungstenProperties holding the AuthenticationInfo
instance.
public static java.lang.Object getMBeanProxy(javax.management.remote.JMXConnector clientConnection,
java.lang.Class<?> mbeanClass,
java.lang.String mbeanName,
boolean notificationBroadcaster,
boolean ignored)
clientConnection - the MBean server to forward tombeanClass - The MBean interface this instance implementsmbeanName - A custom name for this MBeannotificationBroadcaster - If true make the returned proxy implement
NotificationEmitter by forwarding its methods via connection
public static java.lang.Object getMBeanProxy(javax.management.remote.JMXConnector clientConnection,
java.lang.Class<?> mbeanClass,
boolean notificationBroadcaster)
clientConnection - the MBean server to forward tombeanClass - The class for which an MBean existsnotificationBroadcaster - If true make the returned proxy implement
NotificationEmitter by forwarding its methods via connection
public static java.lang.Object getMBeanProxy(javax.management.remote.JMXConnector clientConnection,
java.lang.Class<?> mbeanClass,
java.lang.Class<?> mbeanInterface,
java.lang.String mbeanName,
boolean notificationBroadcaster,
boolean ignored)
clientConnection - the MBean server to forward tombeanClass - The MBean interface this instance implementsmbeanName - A custom name for this MBeannotificationBroadcaster - If true make the returned proxy implement
NotificationEmitter by forwarding its methods via connection
public static void addNotificationListener(javax.management.remote.JMXConnector jmxConnector,
java.lang.Class<?> mbeanInterface,
java.lang.String mbeanName,
javax.management.NotificationListener notificationListener,
boolean ignored)
throws javax.management.InstanceNotFoundException,
java.lang.Exception
jmxConnector - The MBean server connector.mbeanInterface - The MBean interface this instance implements.mbeanName - A custom name for the MBean.notificationListener - User provided NotificationListener instance.
javax.management.InstanceNotFoundException
java.lang.Exception
public static javax.management.MBeanServerConnection getServerConnection(javax.management.remote.JMXConnector jmxConnector)
throws java.lang.Exception
java.lang.Exception
public static void addNotificationListener(javax.management.remote.JMXConnector jmxConnector,
java.lang.Class<?> mbeanClass,
javax.management.NotificationListener notificationListener)
throws javax.management.InstanceNotFoundException,
java.lang.Exception
jmxConnector - The MBean server connector.mbeanClass - The class for which an MBean exists.notificationListener - User provided NotificationListener instance.
javax.management.InstanceNotFoundException
java.lang.Exception
public static void removeNotificationListener(javax.management.remote.JMXConnector jmxConnector,
java.lang.Class<?> mbeanInterface,
java.lang.String mbeanName,
javax.management.NotificationListener notificationListener,
boolean ignored)
throws java.lang.Exception
jmxConnector - The MBean server connector.mbeanInterface - The MBean interface this instance implements.mbeanName - A custom name for the MBean.notificationListener - Previously added NotificationListener
instance.
java.lang.Exception
public static void removeNotificationListener(javax.management.remote.JMXConnector jmxConnector,
java.lang.Class<?> mbeanClass,
javax.management.NotificationListener notificationListener)
throws java.lang.Exception
jmxConnector - The MBean server connector.mbeanClass - The class for which an MBean exists.notificationListener - Previously added NotificationListener
instance.
java.lang.Exception
public static javax.management.ObjectName generateMBeanObjectName(java.lang.Class<?> mbeanClass)
throws java.lang.Exception
java.lang.Exception
public static javax.management.ObjectName generateMBeanObjectName(java.lang.String mbeanName,
java.lang.String typeName)
throws java.lang.Exception
java.lang.Exception
public void handleNotification(javax.management.Notification notification,
java.lang.Object handback)
handleNotification in interface javax.management.NotificationListener
public static DynamicMBeanHelper createHelper(java.lang.Class<?> mbeanClass)
throws java.lang.Exception
java.lang.Exceptionpublic static java.lang.String getHostName()
public java.rmi.registry.Registry getRegistry()
public int getBeanPort()
public static DynamicMBeanHelper createHelper(java.lang.Class<?> mbeanClass,
java.lang.String alias)
throws java.lang.Exception
java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||