當前位置: 首頁>>代碼示例>>Java>>正文


Java MetricManagementService類代碼示例

本文整理匯總了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);
}
 
開發者ID:wso2,項目名稱:carbon-metrics,代碼行數:16,代碼來源:ServiceComponent.java

示例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);
    }
}
 
開發者ID:wso2,項目名稱:carbon-metrics,代碼行數:10,代碼來源:DasMetricsExtension.java

示例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);
    }
}
 
開發者ID:wso2,項目名稱:carbon-metrics,代碼行數:10,代碼來源:JdbcMetricsExtension.java

示例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();
}
 
開發者ID:wso2,項目名稱:carbon-metrics,代碼行數:34,代碼來源:ReporterTest.java

示例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);
}
 
開發者ID:wso2,項目名稱:carbon-metrics,代碼行數:14,代碼來源:MetricsComponent.java

示例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);
}
 
開發者ID:wso2,項目名稱:msf4j,代碼行數:19,代碼來源:MetricsComponent.java

示例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;
}
 
開發者ID:wso2,項目名稱:msf4j,代碼行數:16,代碼來源:Metrics.java

示例8: activate

import org.wso2.carbon.metrics.core.MetricManagementService; //導入依賴的package包/類
void activate(ConfigProvider configProvider, MetricService metricService,
MetricManagementService metricManagementService);
 
開發者ID:wso2,項目名稱:carbon-metrics,代碼行數:3,代碼來源:MetricsExtension.java

示例9: MetricsMXBeanImpl

import org.wso2.carbon.metrics.core.MetricManagementService; //導入依賴的package包/類
public MetricsMXBeanImpl(MetricManagementService metricManagementService) {
    this.metricManagementService = metricManagementService;
}
 
開發者ID:wso2,項目名稱:carbon-metrics,代碼行數:4,代碼來源:MetricsMXBeanImpl.java

示例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);
}
 
開發者ID:wso2,項目名稱:carbon-metrics,代碼行數:9,代碼來源:ServiceComponent.java

示例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;
}
 
開發者ID:wso2,項目名稱:carbon-metrics,代碼行數:9,代碼來源:DataHolder.java

示例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;
}
 
開發者ID:wso2,項目名稱:carbon-metrics,代碼行數:11,代碼來源:DataHolder.java

示例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);
}
 
開發者ID:wso2,項目名稱:msf4j,代碼行數:9,代碼來源:MetricsComponent.java

示例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;
}
 
開發者ID:wso2,項目名稱:msf4j,代碼行數:9,代碼來源:Metrics.java

示例15: deactivate

import org.wso2.carbon.metrics.core.MetricManagementService; //導入依賴的package包/類
void deactivate(MetricService metricService, MetricManagementService metricManagementService); 
開發者ID:wso2,項目名稱:carbon-metrics,代碼行數:2,代碼來源:MetricsExtension.java


注:本文中的org.wso2.carbon.metrics.core.MetricManagementService類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。