CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.net.management
Class MBeanHelper

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.net.management.MBeanHelper
Direct Known Subclasses:
MBeanConnector

public abstract class MBeanHelper
extends Base

Helper class providing various functionality related to aggregation of attributes and methods exposed by Coherence JMX framework MBeans.

Since:
Coherence 3.3
Author:
gg 2007/01/02

Field Summary
static String NETWORK_HEALTH
          The Network Health MBean name.
 
Constructor Summary
MBeanHelper()
           
 
Method Summary
static double calculateAverage(MBeanServer server, String sPattern, String sAttribute)
          Calculate the average of the attribute values across all the MBeans with a given name pattern.
static ObjectName ensureNetworkHealthMBean()
          Ensure that there is an instance of NetworkHealth MBean registered with the default MBeansServer.
static ObjectName ensureSingletonMBean(String sName)
          Ensure that there is an instance of a local MBean of the specified type registered with the default MBeansServer.
static MBeanServer findMBeanServer()
          Find an MBeanServer that Coherence MBeans are registered with.
static MBeanServer findMBeanServer(String sDefaultDomain)
          Find an MBeanServer that has the specified default domain name.
static String getDefaultDomain()
          Return the the default domain name as configured in the Coherence operational configuration descriptor.
static Object startHttpConnector(int nPort, MBeanServer mbs)
          Start a com.sun.jdmk.comm.HtmlAdaptorServer, which is a part of the Sun JMX reference implementation.
static JMXConnectorServer startRmiConnector(String sHost, int nRegPort, int nConPort, MBeanServer mbs, Map mapEnv)
          Start a JMXConnectorServer.
 

Field Detail

NETWORK_HEALTH

public static final String NETWORK_HEALTH
The Network Health MBean name.

See Also:
Constant Field Values
Constructor Detail

MBeanHelper

public MBeanHelper()
Method Detail

getDefaultDomain

public static String getDefaultDomain()
Return the the default domain name as configured in the Coherence operational configuration descriptor.

Returns:
the default domain name

findMBeanServer

public static MBeanServer findMBeanServer()
Find an MBeanServer that Coherence MBeans are registered with.

Returns:
an existing or a new MBeanServer with the default domain name as configured in the Coherence operational configuration descriptor

findMBeanServer

public static MBeanServer findMBeanServer(String sDefaultDomain)
Find an MBeanServer that has the specified default domain name.

Parameters:
sDefaultDomain - the domain name
Returns:
an existing or a new MBeanServer with the specified default domain name

calculateAverage

public static double calculateAverage(MBeanServer server,
                                      String sPattern,
                                      String sAttribute)
Calculate the average of the attribute values across all the MBeans with a given name pattern. The attribute type should be a Number and will be treated as Java double values.

Parameters:
server - the MBeanServer
sPattern - the name pattern
sAttribute - the attribute name
Returns:
an average value

ensureNetworkHealthMBean

public static ObjectName ensureNetworkHealthMBean()
Ensure that there is an instance of NetworkHealth MBean registered with the default MBeansServer.

Returns:
the ObjectName for the registered NetworkHealth MBean

ensureSingletonMBean

public static ObjectName ensureSingletonMBean(String sName)
Ensure that there is an instance of a local MBean of the specified type registered with the default MBeansServer.

Returns:
the ObjectName for the registered MBean

startRmiConnector

public static JMXConnectorServer startRmiConnector(String sHost,
                                                   int nRegPort,
                                                   int nConPort,
                                                   MBeanServer mbs,
                                                   Map mapEnv)
Start a JMXConnectorServer. This method is used to expose the specified MBeanServer to external agents (such as JConsole) using RMI.

Parameters:
sHost - host to bind to
nRegPort - port used for the JMX RMI registry
nConPort - port used for the JMX RMI connection
mbs - MBeanServer that contains Coherence MBeans
mapEnv - a set of attributes to control the new connector server's behavior
Returns:
a JMXConnectorServer that has been started
See Also:
JMXConnectorServerFactory

startHttpConnector

public static Object startHttpConnector(int nPort,
                                        MBeanServer mbs)
Start a com.sun.jdmk.comm.HtmlAdaptorServer, which is a part of the Sun JMX reference implementation. It is being created via reflection to avoid a runtime dependency to this library.

Parameters:
nPort - port to bind the HTTP server to
mbs - MBeanServer that this HTTP server will expose
Returns:
an HtmlAdaptorServer that has been started

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation