Methods Summary |
---|
private static boolean | checkAndPurgeMBean(BaseMonitorMBean parent, BaseMonitorMBean mbean)Purge an mbean if the mbean does not have any child mbean. This method
tries to do
boolean purged = false;
if (mbean != null && parent != null) {
ArrayList childList = mbean.getChildList();
if (childList == null || childList.size() == 0) {
try {
parent.removeChild(mbean);
purged = true;
} catch (Throwable t) {
// Failure in deletion of mbean is not fatal, it will have
// undesirable effect of not removing the module mbean even
// when the application is undeployed, but won't cause any
// harm. So just log the error.
logger.log(Level.FINE, PURGE_MBEAN_FAILED,
mbean.getNodeType() + "/" + mbean.getNodeName());
logger.log(Level.FINEST, PURGE_MBEAN_FAILED_TRACE, t);
}
}
}
return purged;
|
private static void | checkAndPurgeUnusedAppAndModule(java.lang.String appName, BaseMonitorMBean moduleMBean)Purge module mbean if it does not have any child mbean. If module mbean
is purged then also purge application mbean if there are no more modules.
if (moduleMBean == null) {
return;
}
BaseMonitorMBean appMBean = getLevelOneMBean(
MonitoredObjectType.APPLICATION, appName);
boolean purged = checkAndPurgeMBean(appMBean, moduleMBean);
if (purged) {
checkAndPurgeUnusedLevelOneMBean(appMBean);
}
return;
|
private static void | checkAndPurgeUnusedLevelOneMBean(BaseMonitorMBean levelOneMBean)Purge unused mbean at the top level (below root) in the monitoring mbean
tree. Any mbean that does not have children is considered unused.
if (levelOneMBean == null) {
return;
}
GenericMonitorMBean root = GenericMonitorMBean.getRoot();
boolean purged = checkAndPurgeMBean(root, levelOneMBean);
return;
|
private static BaseMonitorMBean | getEJBModuleMBean(java.lang.String appName, java.lang.String moduleName)Get MBean for specified application and ejb module. If the MBean for
application or module does not exist, it returns null.
BaseMonitorMBean module = null;
BaseMonitorMBean app = getLevelOneMBean(MonitoredObjectType.APPLICATION,
appName);
if (app != null) {
module = app.getChildOrNull(
MonitoredObjectType.EJBMODULE, moduleName);
}
return module;
|
private static BaseMonitorMBean | getEJBModuleMBean(java.lang.String standaloneModuleName)Get MBean for specified stand alone ejb module. If the MBean for
stand alone ejb module does not exist, it returns null.
return getLevelOneMBean(
MonitoredObjectType.STANDALONE_EJBMODULE, standaloneModuleName);
|
private static BaseMonitorMBean | getEJBMonitoringMBean(java.lang.String appName, java.lang.String moduleName, java.lang.String ejbName)Get monitoring MBean (in MBeanServer) for a ejb that is part
of specified module in the specified application.
BaseMonitorMBean mbean = null;
BaseMonitorMBean app = getLevelOneMBean(MonitoredObjectType.APPLICATION,
appName);
if (app != null) {
BaseMonitorMBean module = app.getChildOrNull(
MonitoredObjectType.EJBMODULE, moduleName);
if (module != null) {
ArrayList list = module.getChildList(ejbName);
if (!list.isEmpty()) {
mbean = (BaseMonitorMBean)list.get(0);
}
}
}
if (mbean == null) {
String msg = localStrings.getString( "admin.monitor.no_mbean_for_appname_modulename_ejbname", appName, moduleName, ejbName );
throw new InstanceNotFoundException( msg );
}
return mbean;
|
private static BaseMonitorMBean | getEJBMonitoringMBean(java.lang.String standaloneModuleName, java.lang.String ejbName)Get monitoring MBean (in MBeanServer) for a ejb that is part
of specified stand alone ejb module.
BaseMonitorMBean mbean = null;
BaseMonitorMBean module = getLevelOneMBean(
MonitoredObjectType.STANDALONE_EJBMODULE, standaloneModuleName);
if (module != null) {
ArrayList list = module.getChildList(ejbName);
if (!list.isEmpty()) {
mbean = (BaseMonitorMBean)list.get(0);
}
}
if (mbean == null) {
String msg = localStrings.getString( "admin.monitor.no_mbean_for_standalonemodulename_ejbname", standaloneModuleName, ejbName );
throw new InstanceNotFoundException( msg );
}
return mbean;
|
public static javax.management.ObjectName | getEJBMonitoringMBeanName(java.lang.String appName, java.lang.String moduleName, java.lang.String ejbName)Get name of the monitoring MBean (in MBeanServer) for a ejb that is part
of specified module in the specified application.
return getEJBMonitoringMBean(appName, moduleName, ejbName).getObjectName();
|
public static javax.management.ObjectName | getEJBMonitoringMBeanName(java.lang.String standaloneModuleName, java.lang.String ejbName)Get name of the monitoring MBean (in MBeanServer) for a ejb that is part
of specified stand alone ejb module.
return getEJBMonitoringMBean(standaloneModuleName, ejbName).getObjectName();
|
private static BaseMonitorMBean | getLevelOneMBean(MonitoredObjectType type, java.lang.String name)Get a monitoring mbean from top level (immediate child of root monitor
mbean). If the mbean does not exist, it returns null.
GenericMonitorMBean root = GenericMonitorMBean.getRoot();
return root.getChildOrNull(type, name);
|
private static BaseMonitorMBean | getLevelOneMBeanForSure(MonitoredObjectType type, java.lang.String name)Get a monitoring mbean from top level (immediate child of root monitor
mbean). If the mbean does not exist, a generic mbean is created and
added.
GenericMonitorMBean root = GenericMonitorMBean.getRoot();
return getMBeanForSure(root, type, name);
|
private static BaseMonitorMBean | getMBeanForSure(BaseMonitorMBean parent, MonitoredObjectType type, java.lang.String name)Get a MBean of specified type and name contained within specified
parent mbean. If a MBean representing the child does not exist, an
instance of generic mbean is created and added to the parent.
BaseMonitorMBean mbean = parent.getChildOrNull(type, name);
if (mbean == null) {
mbean = new GenericMonitorMBean();
try {
parent.addChild(name, type, mbean);
} catch (InstanceAlreadyExistsException iae) {
// Narrow window between getChildOrNull() and addChild() call
// allows this possibility. So get the child again
mbean = parent.getChildOrNull(type, name);
if (mbean == null) {
// If this is null, don't deal with it (removed?). If this
// exception shows up, synchronize calls to getChildOrNull()
// and addChild() on parent
String msg = localStrings.getString( "admin.monitor.unable_getting_mbean", type, name, parent.getObjectName() );
throw new RuntimeException( msg );
}
} catch (MBeanRegistrationException mbr) {
// This is thrown by errors during execution of method in
// MBeanRegistration interface. GenericMonitorMBean does not
// implement this interace, so if it happens throw a
// RuntimeException
String msg = localStrings.getString( "admin.monitor.rootcause_unable_to_register_mbean", type, name, mbr.getMessage() );
throw new RuntimeException( msg );
}
}
return mbean;
|
public static BaseMonitorMBean | getMonitorMBean(javax.management.ObjectName name)Get monitoring mBean registered in MBean Server with specified name.
BaseMonitorMBean mbean = getMonitorMBeanOrNull(name);
if (mbean == null) {
String msg = localStrings.getString( "admin.monitor.mbean_with_name_not_found", name );
throw new InstanceNotFoundException( msg );
}
return mbean;
|
private static BaseMonitorMBean | getMonitorMBeanOrNull(javax.management.ObjectName name)Get monitoring mBean registered in MBean Server with specified name. If
the mbean with specified name is not found this method returns null.
BaseMonitorMBean mbean =
(BaseMonitorMBean)BaseMonitorMBean.objectNameMap.get(name);
return mbean;
|
private static java.lang.String | getUserOrbMBeanName(java.lang.String hint)Get a unique name for user orb. It tries to uniquify the name by adding
integers to the end of the hint.
if (hint == null || hint.trim().equals("")
|| hint.equalsIgnoreCase(DEFAULT_USER_ORB_HINT)
|| (hint.indexOf(COMMA) != -1)
|| (hint.indexOf(SPACE) != -1)
|| (hint.indexOf(COLON) != -1)
|| (hint.indexOf(EQUALS) != -1)) {
logger.log(Level.FINEST, INVALID_USER_ORB_NAME_HINT, hint);
hint = DEFAULT_USER_ORB_HINT + (++orbNameUniquifier);
}
synchronized (userOrbNames) {
while (userOrbNames.containsKey(hint)) {
logger.log(Level.FINEST, USER_ORB_MBEAN_NAME_USED, hint);
hint = hint + (++orbNameUniquifier);
}
userOrbNames.put(hint, hint);
}
return hint;
|
public static void | registerEJBMethodMonitoringMBean(javax.management.ObjectName ejbMBeanName, java.lang.String methodName, BaseMonitorMBean mbean)
BaseMonitorMBean ejb = getMonitorMBean(ejbMBeanName);
ejb.addChild(methodName, MonitoredObjectType.BEAN_METHOD, mbean);
|
public static javax.management.ObjectName | registerEJBMonitoringMBean(java.lang.String appName, java.lang.String moduleName, java.lang.String ejbName, MonitoredObjectType type, BaseMonitorMBean mbean)Register a monitoring MBean for a ejb that is part of specified
module in the specified application.
BaseMonitorMBean app = getLevelOneMBeanForSure(
MonitoredObjectType.APPLICATION, appName);
BaseMonitorMBean module = getMBeanForSure(app,
MonitoredObjectType.EJBMODULE, moduleName);
module.addChild(ejbName, type, mbean);
return mbean.getObjectName();
|
public static javax.management.ObjectName | registerEJBMonitoringMBean(java.lang.String standaloneModuleName, java.lang.String ejbName, MonitoredObjectType type, BaseMonitorMBean mbean)Register a monitoring MBean for a ejb that is part of specified
stand alone ejb module.
BaseMonitorMBean standaloneModule = getLevelOneMBeanForSure(
MonitoredObjectType.STANDALONE_EJBMODULE, standaloneModuleName);
standaloneModule.addChild(ejbName, type, mbean);
return mbean.getObjectName();
|
public static javax.management.ObjectName | registerJdbcPoolMonitoringMBean(java.lang.String poolName, MonitoredObjectType type, BaseMonitorMBean mbean)
if(AdminService.getAdminService() != null){
BaseMonitorMBean resMBean = getLevelOneMBeanForSure(MonitoredObjectType.RESOURCES,"resources");
resMBean.addChild(poolName, type, mbean);
return mbean.getObjectName();
}
return null;
|
public static javax.management.ObjectName | registerMonitorable(java.lang.String name, IMonitorable monitorable)Register a monitorable object under specified name. A MBean is created
from the monitorable and then registered to MBean server. name is dotted
representation that denotes the position of MBean within the current
context (this instance). [TBD: Dotted notation]
return null;
|
public static javax.management.ObjectName | registerMonitoringMBean(java.lang.String name, BaseMonitorMBean mbean)Register a monitoring MBean under specified name. name is dotted
representation that denotes the position of MBean within the current
context (this instance). [TBD: Dotted notation]
return null;
|
private static void | registerORBMonitoringMBean(java.lang.String name, BaseMonitorMBean mbean)Register a ORB monitoring MBean. ORB monitoring MBeans are registered
under the node iiop-service (which is directly under root node) in the
tree of monitoring mbeans.
if (AdminService.getAdminService() == null) {
String msg = localStrings.getString(
"admin.monitor.admin_service_not_inited");
throw new IllegalStateException(msg);
}
BaseMonitorMBean iiop = getLevelOneMBeanForSure(
MonitoredObjectType.IIOP_SERVICE,
MonitoredObjectType.IIOP_SERVICE.getTypeName());
iiop.addChild(name, MonitoredObjectType.ORB, mbean);
logger.log(Level.FINEST, ORB_MBEAN_REGISTERED, name);
|
public static void | registerSystemORBMonitoringMBean(BaseMonitorMBean mbean)Register a mbean to monitor system ORB. System ORB is created at server
startup.
registerORBMonitoringMBean(SYSTEM_ORB_NAME, mbean);
|
public static javax.management.ObjectName | registerTxnMonitoringMBean(BaseMonitorMBean mbean)Register a monitoring MBean for transaction service.
GenericMonitorMBean.getRoot().addChild(MonitoredObjectType.TXNMGR.getTypeName(), MonitoredObjectType.TXNMGR, mbean);
return mbean.getObjectName();
|
public static void | registerUserORBMonitoringMBean(java.lang.String hint, BaseMonitorMBean mbean)Register a mbean to monitor user created ORB.
if (SYSTEM_ORB_NAME.equalsIgnoreCase(hint)) {
String msg = localStrings.getString(
"admin.monitor.system_orb_name_used", hint);
throw new IllegalArgumentException(msg);
}
registerORBMonitoringMBean(getUserOrbMBeanName(hint), mbean);
|
public static void | unregisterEJBMonitoringMBean(java.lang.String appName, java.lang.String moduleName, java.lang.String ejbName)Unregister a monitoring MBean for a ejb that is part of specified
module in the specified application.
BaseMonitorMBean module = getEJBModuleMBean(appName, moduleName);
BaseMonitorMBean ejb = module.getFirstChildByName(ejbName);
module.removeChild(ejb);
checkAndPurgeUnusedAppAndModule(appName, module);
|
public static void | unregisterEJBMonitoringMBean(java.lang.String standaloneModuleName, java.lang.String ejbName)Unregister a monitoring MBean for a ejb that is part of specified
stand alone ejb module.
BaseMonitorMBean module = getEJBModuleMBean(standaloneModuleName);
BaseMonitorMBean ejb = module.getFirstChildByName(ejbName);
module.removeChild(ejb);
checkAndPurgeUnusedLevelOneMBean(module);
|
public void | unregisterJdbcPoolMonitoringMBean(MonitoredObjectType type, java.lang.String poolName)
BaseMonitorMBean resMBean = getLevelOneMBean(MonitoredObjectType.RESOURCES,"resources");
if(resMBean != null)
resMBean.removeChild(type,poolName);
|
public static void | unregisterMonitorable(java.lang.String name)Unregister a monitorable under specified name. A MBean is created
from the monitorable and then registered to MBean server. name is dotted
representation that denotes the position of MBean within the current
context (this instance). [TBD: Dotted notation]
|
public static void | unregisterMonitoringMBean(java.lang.String name)Unregister a monitoring MBean under specified name. name is dotted
representation that denotes the position of MBean within the current
context (this instance). [TBD: Dotted notation]
|