Examples of StatisticsPlugin


Examples of org.jboss.jca.core.spi.statistics.StatisticsPlugin

                            CommonDeployment deploymentMD = ((ResourceAdapterDeploymentService) controller.getService()).getRaDeployment();

                            if (deploymentMD.getConnectionManagers() != null ) {
                                for (ConnectionManager cm : deploymentMD.getConnectionManagers())  {
                                if(cm.getPool() != null) {
                                    StatisticsPlugin poolStats = cm.getPool().getStatistics();

                                if (poolStats.getNames().size() != 0) {
                                    DescriptionProvider statsResourceDescriptionProvider = new StatisticsDescriptionProvider(ResourceAdaptersSubsystemProviders.RESOURCE_NAME, "statistics", poolStats);
                                    PathElement pe = PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, ResourceAdaptersExtension.SUBSYSTEM_NAME);
                                    PathElement peCD = PathElement.pathElement(Constants.CONNECTIONDEFINITIONS_NAME, cm.getJndiName());
                                    ManagementResourceRegistration overrideRegistration = registration;
                                    //when you are in deploy you have a registration pointing to deployment=*
                                    //when you are in re-deploy it points to specific deploymentUnit
                                    if (registration.isAllowsOverride()) {
                                        overrideRegistration = registration.registerOverrideModel(deploymentUnit.getName(), new OverrideDescriptionProvider() {
                                            @Override
                                            public Map<String, ModelNode> getAttributeOverrideDescriptions(Locale locale) {
                                                return Collections.emptyMap();
                                            }

                                            @Override
                                            public Map<String, ModelNode> getChildTypeOverrideDescriptions(Locale locale) {
                                                return Collections.emptyMap();
                                            }
                                        });
                                    }
                                    ManagementResourceRegistration subRegistration = overrideRegistration.getSubModel(PathAddress.pathAddress(pe));
                                    if (subRegistration == null) {
                                        subRegistration = overrideRegistration.registerSubModel(pe, new SubSystemExtensionDescriptionProvider(ResourceAdaptersSubsystemProviders.RESOURCE_NAME, "statistics"));
                                    }
                                    if (subRegistration.getSubModel(PathAddress.pathAddress(peCD)) == null) {
                                        ManagementResourceRegistration cdSubRegistration = subRegistration.registerSubModel(peCD, statsResourceDescriptionProvider);
                                        for (String statName : poolStats.getNames()) {
                                            cdSubRegistration.registerMetric(statName, new PoolMetrics.ParametrizedPoolMetricsHandler(poolStats));
                                        }
                                        cdSubRegistration.registerOperationHandler("clear-statistics", new ClearStatisticsHandler(poolStats), ResourceAdaptersSubsystemProviders.CLEAR_STATISTICS_DESC, false);
                                    }
                                }
View Full Code Here

Examples of org.jboss.jca.core.spi.statistics.StatisticsPlugin


                            if (deploymentMD.getConnectionManagers() != null) {
                                for (ConnectionManager cm : deploymentMD.getConnectionManagers())  {
                                                                if(cm.getPool() != null) {
                                                                    StatisticsPlugin poolStats = cm.getPool().getStatistics();

                                if (poolStats.getNames().size() != 0) {
                                    DescriptionProvider statsResourceDescriptionProvider = new StatisticsDescriptionProvider(ResourceAdaptersSubsystemProviders.RESOURCE_NAME, "statistics", poolStats);
                                    PathElement pe = PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, ResourceAdaptersExtension.SUBSYSTEM_NAME);
                                    PathElement peCD = PathElement.pathElement(Constants.CONNECTIONDEFINITIONS_NAME, cm.getJndiName());

                                    ManagementResourceRegistration overrideRegistration = registration;
                                    //when you are in deploy you have a registration pointing to deployment=*
                                    //when you are in re-deploy it points to specific deploymentUnit
                                    if (registration.isAllowsOverride() && registration.getOverrideModel(deploymentUnitName) == null) {
                                        overrideRegistration = registration.registerOverrideModel(deploymentUnitName, new OverrideDescriptionProvider() {
                                            @Override
                                            public Map<String, ModelNode> getAttributeOverrideDescriptions(Locale locale) {
                                                return Collections.emptyMap();
                                            }

                                            @Override
                                            public Map<String, ModelNode> getChildTypeOverrideDescriptions(Locale locale) {
                                                return Collections.emptyMap();
                                            }
                                        });
                                    }

                                    ManagementResourceRegistration subRegistration = overrideRegistration.getSubModel(PathAddress.pathAddress(pe));
                                    if (subRegistration == null) {
                                        subRegistration = overrideRegistration.registerSubModel(pe, new SubSystemExtensionDescriptionProvider(ResourceAdaptersSubsystemProviders.RESOURCE_NAME, "statistics"));
                                    }
                                    if (subRegistration.getSubModel(PathAddress.pathAddress(peCD)) == null) {
                                        ManagementResourceRegistration cdSubRegistration = subRegistration.registerSubModel(peCD, statsResourceDescriptionProvider);
                                        for (String statName : poolStats.getNames()) {
                                            cdSubRegistration.registerMetric(statName, new PoolMetrics.ParametrizedPoolMetricsHandler(poolStats));
                                        }
                                        cdSubRegistration.registerOperationHandler("clear-statistics", new ClearStatisticsHandler(poolStats), ResourceAdaptersSubsystemProviders.CLEAR_STATISTICS_DESC, false);
                                    }

View Full Code Here

Examples of org.jboss.jca.core.spi.statistics.StatisticsPlugin

                CommonDeployment deploymentMD = getDeploymentMetadata(controller);

                if (deploymentMD.getConnectionManagers() != null) {
                    for (ConnectionManager cm : deploymentMD.getConnectionManagers()) {
                        if (cm.getPool() != null) {
                            StatisticsPlugin poolStats = cm.getPool().getStatistics();
                            poolStats.setEnabled(false);
                            final ServiceController<?> bootstrapContextController = controller.getServiceContainer().getService(ConnectorServices.BOOTSTRAP_CONTEXT_SERVICE.append(bootstrapCtx));
                            WorkManager wm = null;
                            if (bootstrapContextController != null) {
                                wm = (WorkManager) ((CloneableBootstrapContext) bootstrapContextController.getValue()).getWorkManager();
                            }
                            if ((wm != null && wm.getStatistics() != null) || poolStats.getNames().size() != 0) {

                                PathElement pe = PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, ResourceAdaptersExtension.SUBSYSTEM_NAME);
                                PathElement peStats = PathElement.pathElement(Constants.STATISTICS_NAME, Constants.STATISTICS_NAME);
                                PathElement peRa = PathElement.pathElement(Constants.RESOURCEADAPTER_NAME, raName);
                                PathElement peWm = PathElement.pathElement(Constants.WORKMANAGER_NAME, wm.getName());
                                PathElement peDistributedWm = PathElement.pathElement(Constants.DISTRIBUTED_WORKMANAGER_NAME, wm.getName());
                                PathElement peCD = PathElement.pathElement(Constants.CONNECTIONDEFINITIONS_NAME, cm.getJndiName());
                                ManagementResourceRegistration overrideRegistration = registration;
                                //when you are in deploy you have a registration pointing to deployment=*
                                //when you are in re-deploy it points to specific deploymentUnit
                                synchronized (this) {
                                    if (registration.isAllowsOverride()) {

                                        if (registration.getOverrideModel(deploymentUnitName) != null) {
                                            overrideRegistration = registration.getOverrideModel(deploymentUnitName);
                                        } else {
                                            overrideRegistration = registration.registerOverrideModel(deploymentUnitName, new OverrideDescriptionProvider() {
                                                @Override
                                                public Map<String, ModelNode> getAttributeOverrideDescriptions(Locale locale) {
                                                    return Collections.emptyMap();
                                                }

                                                @Override
                                                public Map<String, ModelNode> getChildTypeOverrideDescriptions(Locale locale) {
                                                    return Collections.emptyMap();
                                                }
                                            });
                                        }

                                    }

                                    ManagementResourceRegistration subRegistration;
                                    try {
                                        ResourceBuilder resourceBuilder = ResourceBuilder.Factory.create(pe,
                                                new StandardResourceDescriptionResolver(Constants.STATISTICS_NAME, CommonAttributes.RESOURCE_NAME, CommonAttributes.class.getClassLoader()));
                                        subRegistration = overrideRegistration.registerSubModel(resourceBuilder.build());

                                        } catch (IllegalArgumentException iae) {
                                        subRegistration = overrideRegistration.getSubModel(PathAddress.pathAddress(pe));
                                    }
                                    Resource subsystemResource;

                                    if (!deploymentResource.hasChild(pe)) {
                                        subsystemResource = new IronJacamarResource.IronJacamarRuntimeResource();
                                        deploymentResource.registerChild(pe, subsystemResource);
                                    } else {
                                        subsystemResource = deploymentResource.getChild(pe);
                                    }

                                    ManagementResourceRegistration statsRegistration;
                                    try {
                                        ResourceBuilder resourceBuilder = ResourceBuilder.Factory.create(peStats,
                                                new StandardResourceDescriptionResolver(Constants.STATISTICS_NAME, CommonAttributes.RESOURCE_NAME, CommonAttributes.class.getClassLoader()));

                                        statsRegistration = subRegistration.registerSubModel(resourceBuilder.build());
                                    } catch (IllegalArgumentException iae) {
                                        statsRegistration = subRegistration.getSubModel(PathAddress.pathAddress(peStats));
                                    }
                                    Resource statisticsResource;

                                    if (!subsystemResource.hasChild(peStats)) {
                                        statisticsResource = new IronJacamarResource.IronJacamarRuntimeResource();
                                        subsystemResource.registerChild(peStats, statisticsResource);
                                    } else {
                                        statisticsResource = subsystemResource.getChild(peStats);
                                    }

                                    ManagementResourceRegistration raRegistration;
                                    try {
                                        ResourceBuilder resourceBuilder = ResourceBuilder.Factory.create(peRa,
                                                new StandardResourceDescriptionResolver(Constants.STATISTICS_NAME, CommonAttributes.RESOURCE_NAME, CommonAttributes.class.getClassLoader()));

                                        raRegistration = statsRegistration.registerSubModel(resourceBuilder.build());
                                    } catch (IllegalArgumentException iae) {
                                        raRegistration = statsRegistration.getSubModel(PathAddress.pathAddress(peRa));
                                    }
                                    Resource raResource;

                                    if (!statisticsResource.hasChild(peRa)) {
                                        raResource = new IronJacamarResource.IronJacamarRuntimeResource();
                                        statisticsResource.registerChild(peRa, raResource);
                                    } else {
                                        raResource = statisticsResource.getChild(peRa);
                                    }
                                    if (deploymentMD.getConnector() != null && deploymentMD.getConnector().getResourceAdapter() != null && deploymentMD.getConnector().getResourceAdapter().getStatistics() != null) {
                                        StatisticsPlugin raStats = deploymentMD.getConnector().getResourceAdapter().getStatistics();
                                        raStats.setEnabled(false);
                                        PoolMetrics.ParametrizedPoolMetricsHandler handler = new PoolMetrics.ParametrizedPoolMetricsHandler(raStats);
                                        for (AttributeDefinition attribute : StatisticsResourceDefinition.getAttributesFromPlugin(raStats)){
                                            raRegistration.registerMetric(attribute, handler);
                                        }
                                        //adding enable/disable for pool stats
View Full Code Here

Examples of org.jboss.jca.core.spi.statistics.StatisticsPlugin

        switch (transition) {
            case STARTING_to_UP: {

                CommonDeployment deploymentMD = ((AbstractDataSourceService) controller.getService()).getDeploymentMD();

                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 (overrideRegistration != null) {
                        if (jdbcStatsSize > 0) {
                            ManagementResourceRegistration jdbcRegistration = overrideRegistration.registerSubModel(new StatisticsResourceDefinition(JDBC_STATISTICS,DataSourcesSubsystemProviders.RESOURCE_NAME, jdbcStats));
                            jdbcRegistration.setRuntimeOnly(true);
View Full Code Here

Examples of org.jboss.jca.core.spi.statistics.StatisticsPlugin

        switch (transition) {
            case STARTING_to_UP: {

                CommonDeployment deploymentMD = ((AbstractDataSourceService) controller.getService()).getDeploymentMD();

                StatisticsPlugin jdbcStats = deploymentMD.getDataSources()[0].getStatistics();
                StatisticsPlugin poolStats = deploymentMD.getDataSources()[0].getPool().getStatistics();
                int jdbcStatsSize = jdbcStats.getNames().size();
                int poolStatsSize = poolStats.getNames().size();
                if (jdbcStatsSize > 0 || poolStatsSize > 0) {
                    ManagementResourceRegistration subRegistration = registration.isAllowsOverride() ? registration.registerOverrideModel(dsName, DataSourcesSubsystemProviders.OVERRIDE_DS_DESC) : registration;

                    if (jdbcStatsSize > 0) {
                        ManagementResourceRegistration jdbcRegistration = subRegistration.registerSubModel(PathElement.pathElement("statistics", "jdbc"), new StatisticsDescriptionProvider(DataSourcesSubsystemProviders.RESOURCE_NAME, "statistics", jdbcStats));
                        jdbcRegistration.setRuntimeOnly(true);
                        jdbcRegistration.registerOperationHandler("clear-statistics", new ClearStatisticsHandler(jdbcStats), DataSourcesSubsystemProviders.CLEAR_STATISTICS_DESC, false);

                        for (String statName : jdbcStats.getNames()) {
                            jdbcRegistration.registerMetric(statName, new PoolMetrics.ParametrizedPoolMetricsHandler(jdbcStats));
                        }

                    }

                    if (poolStatsSize > 0) {
                        ManagementResourceRegistration poolRegistration = subRegistration.registerSubModel(PathElement.pathElement("statistics", "pool"), new StatisticsDescriptionProvider(DataSourcesSubsystemProviders.RESOURCE_NAME, "statistics", poolStats));
                        poolRegistration.setRuntimeOnly(true);
                        poolRegistration.registerOperationHandler("clear-statistics", new ClearStatisticsHandler(poolStats), DataSourcesSubsystemProviders.CLEAR_STATISTICS_DESC, false);

                        for (String statName : poolStats.getNames()) {
                            poolRegistration.registerMetric(statName, new PoolMetrics.ParametrizedPoolMetricsHandler(poolStats));
                        }
                    }
                }
                break;
View Full Code Here

Examples of org.jboss.jca.core.spi.statistics.StatisticsPlugin

                        synchronized(registration) {
                            CommonDeployment deploymentMD = ((ResourceAdapterXmlDeploymentService) controller.getService()).getRaxmlDeployment();


                            if (deploymentMD.getConnectionManagers() != null && deploymentMD.getConnectionManagers()[0].getPool() != null) {
                                StatisticsPlugin poolStats = deploymentMD.getConnectionManagers()[0].getPool().getStatistics();
                                if (poolStats.getNames().size() != 0) {
                                    DescriptionProvider statsResourceDescriptionProvider = new StatisticsDescriptionProvider(ResourceAdaptersSubsystemProviders.RESOURCE_NAME, "statistics", poolStats);
                                    PathElement pe = PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, ResourceAdaptersExtension.SUBSYSTEM_NAME);
                                    ManagementResourceRegistration overrideRegistration = registration;
                                    //when you are in deploy you have a registration pointing to deployment=*
                                    //when you are in re-deploy it points to specific deploymentUnit
                                    if (registration.isAllowsOverride() && registration.getOverrideModel(deploymentUnitName) == null) {
                                        overrideRegistration = registration.registerOverrideModel(deploymentUnitName, new OverrideDescriptionProvider() {
                                            @Override
                                            public Map<String, ModelNode> getAttributeOverrideDescriptions(Locale locale) {
                                                return Collections.emptyMap();
                                            }

                                            @Override
                                            public Map<String, ModelNode> getChildTypeOverrideDescriptions(Locale locale) {
                                                return Collections.emptyMap();
                                            }
                                        });
                                    }
                                    if (overrideRegistration.getSubModel(PathAddress.pathAddress(pe)) == null) {
                                        ManagementResourceRegistration subRegistration = overrideRegistration.registerSubModel(pe, statsResourceDescriptionProvider);
                                        for (String statName : poolStats.getNames()) {
                                            subRegistration.registerMetric(statName, new PoolMetrics.ParametrizedPoolMetricsHandler(poolStats));
                                        }
                                        subRegistration.registerOperationHandler("clear-statistics", new ClearStatisticsHandler(poolStats), ResourceAdaptersSubsystemProviders.CLEAR_STATISTICS_DESC, false);
                                    }
                                }
View Full Code Here

Examples of org.jboss.jca.core.spi.statistics.StatisticsPlugin

                switch (transition) {
                    case STARTING_to_UP: {

                        CommonDeployment deploymentMD = ((AbstractDataSourceService) controller.getService()).getDeploymentMD();

                        StatisticsPlugin jdbcStats = deploymentMD.getDataSources()[0].getStatistics();
                        StatisticsPlugin poolStats = deploymentMD.getDataSources()[0].getPool().getStatistics();
                        int jdbcStatsSize = jdbcStats.getNames().size();
                        int poolStatsSize = poolStats.getNames().size();
                        if (jdbcStatsSize > 0 || poolStatsSize > 0) {
                            // TODO. This mixes the statistics attributes in with the regular attributes exposed by
                            // the generic DS resource. This may be annoying to clients??
                            // Consider registering an override model (e.g. /subsystem=datasource/datasource=H2DS)
                            // solely to add a description of children "statistics=jdbc" and "statistics=pool" and then
                            // add non-override but DS-specific submodel registrations for those two statistics children
                            // to the override model. So, we end up with:
                            // /subsystem=datasources/datasource=*  -- common attributes, ops, children
                            // /subsystem=datasources/datasource=H2DS -- placeholder
                            // /subsystem=datasources/datasource=H2DS/statistics=jdbc  -- H2DS-specific stats
                            // /subsystem=datasources/datasource=H2DS/statistics=pool  -- H2DS-specific stats
                            // /subsystem=datasources/datasource=OracleDS -- placeholder
                            // /subsystem=datasources/datasource=OracleDS/statistics=jdbc  -- OracleDS-specific stats
                            // /subsystem=datasources/datasource=OracleDS/statistics=pool  -- OracleDS-specific stats
                            ManagementResourceRegistration subRegistration = registration.registerOverrideModel(dsName, DataSourcesSubsystemProviders.OVERRIDE_DS_DESC);

                            if (jdbcStatsSize > 0) {
                                ManagementResourceRegistration jdbcRegistration = subRegistration.registerSubModel(PathElement.pathElement("statistics", "jdbc"), new StatisticsDescriptionProvider(DataSourcesSubsystemProviders.RESOURCE_NAME, "statistics", jdbcStats));
                                jdbcRegistration.setRuntimeOnly(true);
                                jdbcRegistration.registerOperationHandler("clear-statistics", new ClearStatisticsHandler(jdbcStats), DataSourcesSubsystemProviders.CLEAR_STATISTICS_DESC, false);

                                for (String statName : jdbcStats.getNames()) {
                                    jdbcRegistration.registerMetric(statName, new PoolMetrics.ParametrizedPoolMetricsHandler(jdbcStats));
                                }

                            }

                            if (poolStatsSize > 0) {
                                ManagementResourceRegistration poolRegistration = subRegistration.registerSubModel(PathElement.pathElement("statistics", "pool"), new StatisticsDescriptionProvider(DataSourcesSubsystemProviders.RESOURCE_NAME, "statistics", poolStats));
                                poolRegistration.setRuntimeOnly(true);
                                poolRegistration.registerOperationHandler("clear-statistics", new ClearStatisticsHandler(poolStats), DataSourcesSubsystemProviders.CLEAR_STATISTICS_DESC, false);

                                for (String statName : poolStats.getNames()) {
                                    poolRegistration.registerMetric(statName, new PoolMetrics.ParametrizedPoolMetricsHandler(poolStats));
                                }
                            }
                        }
                        break;
View Full Code Here

Examples of org.jboss.jca.core.spi.statistics.StatisticsPlugin

                        case STARTING_to_UP: {

                            CommonDeployment deploymentMD = ((ResourceAdapterDeploymentService) controller.getService()).getRaDeployment();

                            if (deploymentMD.getConnectionManagers() != null && deploymentMD.getConnectionManagers()[0].getPool() != null) {
                                StatisticsPlugin poolStats = deploymentMD.getConnectionManagers()[0].getPool().getStatistics();
                                if (poolStats.getNames().size() != 0) {
                                    DescriptionProvider statsResourceDescriptionProvider = new StatisticsDescriptionProvider(ResourceAdaptersSubsystemProviders.RESOURCE_NAME, "statistics", poolStats);
                                    PathElement pe = PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, ResourceAdaptersExtension.SUBSYSTEM_NAME);
                                    ManagementResourceRegistration overrideRegistration = registration;
                                    //when you are in deploy you have a registration pointing to deployment=*
                                    //when you are in re-deploy it points to specific deploymentUnit
                                    if (registration.isAllowsOverride()) {
                                        overrideRegistration = registration.registerOverrideModel(deploymentUnit.getName(), new OverrideDescriptionProvider() {
                                            @Override
                                            public Map<String, ModelNode> getAttributeOverrideDescriptions(Locale locale) {
                                                return Collections.emptyMap();
                                            }

                                            @Override
                                            public Map<String, ModelNode> getChildTypeOverrideDescriptions(Locale locale) {
                                                return Collections.emptyMap();
                                            }
                                        });
                                    }

                                    if (overrideRegistration.getSubModel(PathAddress.pathAddress(pe)) == null) {
                                        ManagementResourceRegistration subRegistration = overrideRegistration.registerSubModel(pe, statsResourceDescriptionProvider);
                                        for (String statName : poolStats.getNames()) {
                                            subRegistration.registerMetric(statName, new PoolMetrics.ParametrizedPoolMetricsHandler(poolStats));
                                        }
                                        subRegistration.registerOperationHandler("clear-statistics", new ClearStatisticsHandler(poolStats), ResourceAdaptersSubsystemProviders.CLEAR_STATISTICS_DESC, false);
                                    }
                                }
View Full Code Here

Examples of org.jboss.jca.core.spi.statistics.StatisticsPlugin

                        case STARTING_to_UP: {

                            CommonDeployment deploymentMD = ((ResourceAdapterXmlDeploymentService) controller.getService()).getRaxmlDeployment();

                            if (deploymentMD.getConnectionManagers() != null && deploymentMD.getConnectionManagers()[0].getPool() != null) {
                                StatisticsPlugin poolStats = deploymentMD.getConnectionManagers()[0].getPool().getStatistics();
                                if (poolStats.getNames().size() != 0) {
                                    DescriptionProvider statsResourceDescriptionProvider = new StatisticsDescriptionProvider(ResourceAdaptersSubsystemProviders.RESOURCE_NAME, "statistics", poolStats);
                                    PathElement pe = PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, ResourceAdaptersExtension.SUBSYSTEM_NAME);
                                    ManagementResourceRegistration overrideRegistration = registration;
                                    //when you are in deploy you have a registration pointing to deployment=*
                                    //when you are in re-deploy it points to specific deploymentUnit
                                    if (registration.isAllowsOverride()) {
                                        overrideRegistration = registration.registerOverrideModel(deploymentUnitName, new OverrideDescriptionProvider() {
                                            @Override
                                            public Map<String, ModelNode> getAttributeOverrideDescriptions(Locale locale) {
                                                return Collections.emptyMap();
                                            }

                                            @Override
                                            public Map<String, ModelNode> getChildTypeOverrideDescriptions(Locale locale) {
                                                return Collections.emptyMap();
                                            }
                                        });
                                    }
                                    if (overrideRegistration.getSubModel(PathAddress.pathAddress(pe)) == null) {
                                        ManagementResourceRegistration subRegistration = overrideRegistration.registerSubModel(pe, statsResourceDescriptionProvider);
                                        for (String statName : poolStats.getNames()) {
                                            subRegistration.registerMetric(statName, new PoolMetrics.ParametrizedPoolMetricsHandler(poolStats));
                                        }
                                        subRegistration.registerOperationHandler("clear-statistics", new ClearStatisticsHandler(poolStats), ResourceAdaptersSubsystemProviders.CLEAR_STATISTICS_DESC, false);
                                    }
                                }
View Full Code Here

Examples of org.jboss.jca.core.spi.statistics.StatisticsPlugin

                CommonDeployment deploymentMD = getDeploymentMetadata(controller);

                if (deploymentMD.getConnectionManagers() != null) {
                    for (ConnectionManager cm : deploymentMD.getConnectionManagers()) {
                        if (cm.getPool() != null) {
                            StatisticsPlugin poolStats = cm.getPool().getStatistics();

                            if (poolStats.getNames().size() != 0) {
                                DescriptionProvider statsResourceDescriptionProvider = new StatisticsDescriptionProvider(ResourceAdaptersSubsystemProviders.RESOURCE_NAME, "statistics", poolStats);
                                PathElement pe = PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, ResourceAdaptersExtension.SUBSYSTEM_NAME);
                                PathElement peStats = PathElement.pathElement(Constants.STATISTICS_NAME, Constants.STATISTICS_NAME);
                                PathElement peCD = PathElement.pathElement(Constants.CONNECTIONDEFINITIONS_NAME, cm.getJndiName());
                                ManagementResourceRegistration overrideRegistration = registration;
                                //when you are in deploy you have a registration pointing to deployment=*
                                //when you are in re-deploy it points to specific deploymentUnit
                                if (registration.isAllowsOverride() && registration.getOverrideModel(deploymentUnitName)== null) {
                                    overrideRegistration = registration.registerOverrideModel(deploymentUnitName, new OverrideDescriptionProvider() {
                                        @Override
                                        public Map<String, ModelNode> getAttributeOverrideDescriptions(Locale locale) {
                                            return Collections.emptyMap();
                                        }

                                        @Override
                                        public Map<String, ModelNode> getChildTypeOverrideDescriptions(Locale locale) {
                                            return Collections.emptyMap();
                                        }
                                    });
                                } else {
                                    overrideRegistration = registration.getOverrideModel(deploymentUnitName);
                                }
                                ManagementResourceRegistration subRegistration = overrideRegistration.getSubModel(PathAddress.pathAddress(pe));
                                if (subRegistration == null) {
                                    subRegistration = overrideRegistration.registerSubModel(pe, new SubSystemExtensionDescriptionProvider(ResourceAdaptersSubsystemProviders.RESOURCE_NAME, "deployment-subsystem"));
                                }
                                final Resource subsystemResource = new IronJacamarResource.IronJacamarRuntimeResource();

                                deploymentResource.registerChild(pe, subsystemResource);

                                ManagementResourceRegistration statsRegistration = subRegistration.getSubModel(PathAddress.pathAddress(peStats));
                                if (statsRegistration == null) {
                                    statsRegistration = subRegistration.registerSubModel(peStats, new StatisticsElementDescriptionProvider(ResourceAdaptersSubsystemProviders.RESOURCE_NAME, "statistics"));
                                }
                                final Resource statisticsResource = new IronJacamarResource.IronJacamarRuntimeResource();

                                subsystemResource.registerChild(peStats, statisticsResource);

                                if (statsRegistration.getSubModel(PathAddress.pathAddress(peCD)) == null) {
                                    ManagementResourceRegistration cdSubRegistration = statsRegistration.registerSubModel(peCD, statsResourceDescriptionProvider);
                                    final Resource cdResource = new IronJacamarResource.IronJacamarRuntimeResource();

                                    statisticsResource.registerChild(peCD, cdResource);

                                    for (String statName : poolStats.getNames()) {
                                        cdSubRegistration.registerMetric(statName, new PoolMetrics.ParametrizedPoolMetricsHandler(poolStats));
                                    }
                                    cdSubRegistration.registerOperationHandler("clear-statistics", new ClearStatisticsHandler(poolStats), ResourceAdaptersSubsystemProviders.CLEAR_STATISTICS_DESC, false);
                                }

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.