use of org.glassfish.jdbc.pool.monitor.JdbcConnPoolStatsProvider in project Payara by payara.
the class JdbcPoolMonitoringExtension method registerPool.
/**
* Register jdbc connection pool to the StatsProviderManager.
* Add the pool lifecycle listeners for the pool to receive events on
* change of any of the monitoring attribute values.
* Finally, add this provider to the list of jdbc providers maintained.
* @param poolInfo
*/
@Override
public void registerPool(PoolInfo poolInfo) {
if (poolManager.getPool(poolInfo) != null) {
getProbeProviderUtil().createJdbcProbeProvider();
// Found in the pool table (pool has been initialized/created)
JdbcConnPoolStatsProvider jdbcPoolStatsProvider = new JdbcConnPoolStatsProvider(poolInfo, logger);
StatsProviderManager.register("jdbc-connection-pool", PluginPoint.SERVER, ConnectorsUtil.getPoolMonitoringSubTreeRoot(poolInfo, true), jdbcPoolStatsProvider);
// String jdbcPoolName = jdbcPoolStatsProvider.getJdbcPoolName();
PoolLifeCycleListenerRegistry registry = connectionPoolStatsProviderBootstrapProvider.get().registerPool(poolInfo, getProbeProviderUtil().getJdbcProbeProvider());
jdbcPoolStatsProvider.setPoolRegistry(registry);
jdbcStatsProviders.add(jdbcPoolStatsProvider);
}
}
use of org.glassfish.jdbc.pool.monitor.JdbcConnPoolStatsProvider in project Payara by payara.
the class JdbcPoolMonitoringExtension method unregisterPool.
/**
* Unregister Jdbc Connection pool from the StatsProviderManager.
* Remove the pool lifecycle listeners associated with this pool.
* @param poolInfo
*/
@Override
public void unregisterPool(PoolInfo poolInfo) {
if (jdbcStatsProviders != null) {
Iterator i = jdbcStatsProviders.iterator();
while (i.hasNext()) {
JdbcConnPoolStatsProvider jdbcPoolStatsProvider = (JdbcConnPoolStatsProvider) i.next();
if (poolInfo.equals(jdbcPoolStatsProvider.getPoolInfo())) {
// Get registry and unregister this pool from the registry
PoolLifeCycleListenerRegistry poolRegistry = jdbcPoolStatsProvider.getPoolRegistry();
poolRegistry.unRegisterPoolLifeCycleListener(poolInfo);
StatsProviderManager.unregister(jdbcPoolStatsProvider);
i.remove();
}
}
}
connectionPoolStatsProviderBootstrapProvider.get().postUnregisterPool(poolInfo);
}
Aggregations