use of org.jboss.as.connector.dynamicresource.StatisticsResourceDefinition in project wildfly by wildfly.
the class DataSourceStatisticsService method start.
@Override
public void start(StartContext context) throws StartException {
ROOT_LOGGER.debugf("Starting DataSourceStatisticsService");
synchronized (JDBC_STATISTICS) {
CommonDeployment deploymentMD = injectedDeploymentMD.getValue();
StatisticsPlugin jdbcStats = deploymentMD.getDataSources()[0].getStatistics();
StatisticsPlugin poolStats = deploymentMD.getDataSources()[0].getPool().getStatistics();
jdbcStats.setEnabled(statsEnabled);
poolStats.setEnabled(statsEnabled);
int jdbcStatsSize = jdbcStats.getNames().size();
int poolStatsSize = poolStats.getNames().size();
if (jdbcStatsSize > 0 || poolStatsSize > 0) {
if (registration != null) {
if (jdbcStatsSize > 0) {
if (registration.getSubModel(PathAddress.pathAddress(JDBC_STATISTICS)) == null) {
// TODO WFLY-5285 get rid of redundant .setRuntimeOnly once WFCORE-959 is integrated
ManagementResourceRegistration jdbcRegistration = registration.registerSubModel(new StatisticsResourceDefinition(JDBC_STATISTICS, DataSourcesSubsystemProviders.RESOURCE_NAME, jdbcStats));
jdbcRegistration.setRuntimeOnly(true);
}
}
if (poolStatsSize > 0) {
if (registration.getSubModel(PathAddress.pathAddress(POOL_STATISTICS)) == null) {
// TODO WFLY-5285 get rid of redundant .setRuntimeOnly once WFCORE-959 is integrated
ManagementResourceRegistration poolRegistration = registration.registerSubModel(new StatisticsResourceDefinition(POOL_STATISTICS, DataSourcesSubsystemProviders.RESOURCE_NAME, poolStats));
poolRegistration.setRuntimeOnly(true);
}
}
}
}
}
}
Aggregations