本文整理汇总了Java中org.wso2.carbon.metrics.core.MetricManagementService类的典型用法代码示例。如果您正苦于以下问题:Java MetricManagementService类的具体用法?Java MetricManagementService怎么用?Java MetricManagementService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MetricManagementService类属于org.wso2.carbon.metrics.core包,在下文中一共展示了MetricManagementService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setMetricManagementService
import org.wso2.carbon.metrics.core.MetricManagementService; //导入依赖的package包/类
/**
* This bind method will be called when {@link MetricManagementService} is registered.
*
* @param metricManagementService The {@link MetricManagementService} instance registered as an OSGi service
*/
@Reference(
name = "carbon.metrics.management.service",
service = MetricManagementService.class,
cardinality = ReferenceCardinality.MANDATORY,
policy = ReferencePolicy.DYNAMIC,
unbind = "unsetMetricManagementService"
)
protected void setMetricManagementService(MetricManagementService metricManagementService) {
DataHolder.getInstance().setMetricManagementService(metricManagementService);
}
示例2: deactivate
import org.wso2.carbon.metrics.core.MetricManagementService; //导入依赖的package包/类
/**
* Remove DAS Reporters.
*/
@Override
public void deactivate(MetricService metricService, MetricManagementService metricManagementService) {
if (names != null) {
Arrays.stream(names).forEach(metricManagementService::removeReporter);
}
}
示例3: deactivate
import org.wso2.carbon.metrics.core.MetricManagementService; //导入依赖的package包/类
/**
* Remove JDBC Reporters.
*/
@Override
public void deactivate(MetricService metricService, MetricManagementService metricManagementService) {
if (names != null) {
Arrays.stream(names).forEach(metricManagementService::removeReporter);
}
}
示例4: testJDBCReporterCustomDatasource
import org.wso2.carbon.metrics.core.MetricManagementService; //导入依赖的package包/类
@Test
public void testJDBCReporterCustomDatasource() throws ConfigurationException {
// reload with custom jdbc config
Metrics metrics = new Metrics(TestUtils.getConfigProvider("metrics-jdbc.yaml"));
metrics.activate();
MetricService metricService = metrics.getMetricService();
MetricManagementService metricManagementService = metrics.getMetricManagementService();
Assert.assertTrue(metricManagementService.isReporterRunning("JDBC"));
String meterName = MetricService.name(this.getClass(), "test-jdbc-datasource");
Meter meter = metricService.meter(meterName, Level.INFO);
meter.mark();
metricManagementService.report("JDBC");
List<Map<String, Object>> meterResult =
template.queryForList("SELECT * FROM METRIC_METER WHERE NAME = ?", meterName);
Assert.assertEquals(meterResult.size(), 1);
Assert.assertEquals(meterResult.get(0).get("NAME"), meterName);
Assert.assertEquals(meterResult.get(0).get("COUNT"), 1L);
meter.mark();
metricManagementService.report();
List<Map<String, Object>> meterResult2 =
template.queryForList("SELECT * FROM METRIC_METER WHERE NAME = ? ORDER BY TIMESTAMP DESC", meterName);
Assert.assertEquals(meterResult2.size(), 2);
Assert.assertEquals(meterResult2.get(0).get("NAME"), meterName, "Meter should be available");
Assert.assertEquals(meterResult2.get(0).get("COUNT"), 2L, "Meter count should be two");
Assert.assertEquals(meterResult2.get(1).get("COUNT"), 1L, "Meter count should be one");
metricManagementService.stopReporter("JDBC");
Assert.assertFalse(metricManagementService.isReporterRunning("JDBC"));
metrics.deactivate();
}
示例5: activate
import org.wso2.carbon.metrics.core.MetricManagementService; //导入依赖的package包/类
@Activate
protected void activate(BundleContext bundleContext) {
if (logger.isDebugEnabled()) {
logger.debug("Metrics Component activated");
}
Utils.setCarbonEnvironment(true);
metrics = new Metrics(configProvider);
metrics.activate();
metricServiceRegistration = bundleContext.registerService(MetricService.class, metrics.getMetricService(),
null);
metricManagementServiceRegistration = bundleContext.registerService(MetricManagementService.class,
metrics.getMetricManagementService(), null);
}
示例6: setMetricManagementService
import org.wso2.carbon.metrics.core.MetricManagementService; //导入依赖的package包/类
/**
* This bind method will be called when {@link MetricManagementService} is registered.
*
* @param metricManagementService The {@link MetricManagementService} instance registered as an OSGi service
*/
@Reference(
name = "carbon.metrics.management.service",
service = MetricManagementService.class,
cardinality = ReferenceCardinality.MANDATORY,
policy = ReferencePolicy.DYNAMIC,
unbind = "unsetMetricManagementService"
)
protected void setMetricManagementService(MetricManagementService metricManagementService) {
if (logger.isDebugEnabled()) {
logger.debug("Setting MetricManagementService reference");
}
Metrics.getInstance().setMetricManagementService(metricManagementService);
}
示例7: getMetricManagementService
import org.wso2.carbon.metrics.core.MetricManagementService; //导入依赖的package包/类
/**
* Returns the {@link MetricManagementService}
*
* @return The {@link MetricManagementService} instance
*/
public MetricManagementService getMetricManagementService() {
if (metricManagementService == null) {
synchronized (this) {
if (metricManagementService == null) {
initializeServices();
}
}
}
return metricManagementService;
}
示例8: activate
import org.wso2.carbon.metrics.core.MetricManagementService; //导入依赖的package包/类
void activate(ConfigProvider configProvider, MetricService metricService,
MetricManagementService metricManagementService);
示例9: MetricsMXBeanImpl
import org.wso2.carbon.metrics.core.MetricManagementService; //导入依赖的package包/类
public MetricsMXBeanImpl(MetricManagementService metricManagementService) {
this.metricManagementService = metricManagementService;
}
示例10: unsetMetricManagementService
import org.wso2.carbon.metrics.core.MetricManagementService; //导入依赖的package包/类
/**
* This is the unbind method which gets called at the un-registration of {@link MetricManagementService}
*
* @param metricManagementService The {@link MetricManagementService} instance registered as an OSGi service
*/
protected void unsetMetricManagementService(MetricManagementService metricManagementService) {
DataHolder.getInstance().setMetricManagementService(null);
}
示例11: getMetricManagementService
import org.wso2.carbon.metrics.core.MetricManagementService; //导入依赖的package包/类
/**
* Returns the {@link MetricManagementService}, which is set by the service component
*
* @return The {@link MetricManagementService} instance
*/
public MetricManagementService getMetricManagementService() {
return metricManagementService;
}
示例12: setMetricManagementService
import org.wso2.carbon.metrics.core.MetricManagementService; //导入依赖的package包/类
/**
* Set the {@link MetricManagementService} when the service component gets a reference to the
* {@link MetricManagementService} instance.
*
* @param metricManagementService The {@link MetricManagementService} reference being passed through the service
* component
*/
public void setMetricManagementService(MetricManagementService metricManagementService) {
this.metricManagementService = metricManagementService;
}
示例13: unsetMetricManagementService
import org.wso2.carbon.metrics.core.MetricManagementService; //导入依赖的package包/类
/**
* This is the unbind method which gets called at the un-registration of {@link MetricManagementService}
*
* @param metricManagementService The {@link MetricManagementService} instance registered as an OSGi service
*/
protected void unsetMetricManagementService(MetricManagementService metricManagementService) {
Metrics.getInstance().setMetricManagementService(null);
}
示例14: setMetricManagementService
import org.wso2.carbon.metrics.core.MetricManagementService; //导入依赖的package包/类
/**
* Set the {@link MetricManagementService} service
*
* @param metricManagementService The {@link MetricManagementService} reference
*/
void setMetricManagementService(MetricManagementService metricManagementService) {
this.metricManagementService = metricManagementService;
}
示例15: deactivate
import org.wso2.carbon.metrics.core.MetricManagementService; //导入依赖的package包/类
void deactivate(MetricService metricService, MetricManagementService metricManagementService);