Search in sources :

Example 1 with JdbcConnPoolAppStatsProvider

use of org.glassfish.jdbc.pool.monitor.JdbcConnPoolAppStatsProvider in project Payara by payara.

the class JdbcPoolMonitoringExtension method registerConnectionPool.

/**
 * Register the jdbc connection pool Stats Provider object to the
 * monitoring framework under the specific application name monitoring
 * sub tree.
 *
 * @param appName
 * @return
 */
@Override
public ConnectionPoolAppProbeProvider registerConnectionPool(PoolInfo poolInfo, String appName) {
    ConnectionPoolAppProbeProvider probeAppProvider = null;
    ResourcePool pool = runtime.getConnectionPoolConfig(poolInfo);
    if (pool instanceof JdbcConnectionPool) {
        probeAppProvider = new JdbcConnPoolAppProbeProvider();
        JdbcConnPoolAppStatsProvider jdbcPoolAppStatsProvider = new JdbcConnPoolAppStatsProvider(poolInfo, appName);
        StatsProviderManager.register("jdbc-connection-pool", PluginPoint.SERVER, "resources/" + ConnectorsUtil.escapeResourceNameForMonitoring(poolInfo.getName()) + "/" + appName, jdbcPoolAppStatsProvider);
        jdbcPoolAppStatsProviders.add(jdbcPoolAppStatsProvider);
    }
    return probeAppProvider;
}
Also used : JdbcConnPoolAppStatsProvider(org.glassfish.jdbc.pool.monitor.JdbcConnPoolAppStatsProvider) ConnectionPoolAppProbeProvider(com.sun.enterprise.resource.pool.monitor.ConnectionPoolAppProbeProvider) JdbcConnPoolAppProbeProvider(org.glassfish.jdbc.pool.monitor.JdbcConnPoolAppProbeProvider) JdbcConnectionPool(org.glassfish.jdbc.config.JdbcConnectionPool) ResourcePool(com.sun.enterprise.config.serverbeans.ResourcePool)

Example 2 with JdbcConnPoolAppStatsProvider

use of org.glassfish.jdbc.pool.monitor.JdbcConnPoolAppStatsProvider in project Payara by payara.

the class JdbcPoolMonitoringExtension method unRegisterConnectionPool.

/**
 * Unregister the AppStatsProviders registered for this connection pool.
 */
@Override
public void unRegisterConnectionPool() {
    Iterator jdbcProviders = jdbcPoolAppStatsProviders.iterator();
    while (jdbcProviders.hasNext()) {
        JdbcConnPoolAppStatsProvider jdbcPoolAppStatsProvider = (JdbcConnPoolAppStatsProvider) jdbcProviders.next();
        StatsProviderManager.unregister(jdbcPoolAppStatsProvider);
    }
    jdbcPoolAppStatsProviders.clear();
}
Also used : JdbcConnPoolAppStatsProvider(org.glassfish.jdbc.pool.monitor.JdbcConnPoolAppStatsProvider) Iterator(java.util.Iterator)

Aggregations

JdbcConnPoolAppStatsProvider (org.glassfish.jdbc.pool.monitor.JdbcConnPoolAppStatsProvider)2 ResourcePool (com.sun.enterprise.config.serverbeans.ResourcePool)1 ConnectionPoolAppProbeProvider (com.sun.enterprise.resource.pool.monitor.ConnectionPoolAppProbeProvider)1 Iterator (java.util.Iterator)1 JdbcConnectionPool (org.glassfish.jdbc.config.JdbcConnectionPool)1 JdbcConnPoolAppProbeProvider (org.glassfish.jdbc.pool.monitor.JdbcConnPoolAppProbeProvider)1