private void enableConnectorConnectionPoolMonitoring(ResourcePool pool,
final String poolName) {
MonitorableResourcePool mrp = null;
final ResourcesUtil resUtil = ResourcesUtil.createInstance();
if ( pool instanceof MonitorableResourcePool ) {
mrp = (MonitorableResourcePool)pool;
} else {
return;
}
final com.sun.enterprise.config.serverbeans.ConnectorConnectionPool ccp =
resUtil.getConnectorConnectionPoolByName(poolName);
//this is a connector connection pool
//check if monitoring level is ON and only then do
//registration
if (getConnectorPoolMonitoringLevel() != MonitoringLevel.OFF ) {
final ConnectorConnectionPoolStatsImpl ccpStatsImpl =
new ConnectorConnectionPoolStatsImpl(mrp );
if (getConnectorPoolMonitoringLevel() == MonitoringLevel.HIGH ) {
setMonitoringEnabledHigh( poolName );
}
if (getConnectorPoolMonitoringLevel() == MonitoringLevel.LOW ) {
setMonitoringEnabledLow(poolName );
}
AccessController.doPrivileged( new PrivilegedAction() {
public Object run() {
try {
monitoringRegistry_.registerConnectorConnectionPoolStats(
ccpStatsImpl,
poolName,
resUtil.getAppName(ccp),
resUtil.getRAName(ccp),
null);
} catch( Exception mre ) {
_logger.log( Level.INFO, "poolmon.cannot_reg",
(mre.getMessage() != null ? mre.getMessage() : " ") );
_logger.fine("Error while enabling Connector Pool monitoring for pool "