当前位置: 首页>>代码示例>>Java>>正文


Java Timer类代码示例

本文整理汇总了Java中org.wso2.carbon.metrics.core.Timer的典型用法代码示例。如果您正苦于以下问题:Java Timer类的具体用法?Java Timer怎么用?Java Timer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Timer类属于org.wso2.carbon.metrics.core包,在下文中一共展示了Timer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRandomNumbers

import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
@Override
public int[] getRandomNumbers() {
    Timer.Context context = timer.start();
    try {
        int[] numbers = random.ints(random.nextInt(1000001), randomNumberOrigin, randomNumberBound).toArray();
        histogram.update(numbers.length);
        return numbers;
    } finally {
        context.stop();
    }
}
 
开发者ID:wso2,项目名称:carbon-metrics,代码行数:12,代码来源:RandomNumberServiceImpl.java

示例2: testTimer

import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
@Test
public void testTimer() {
    Timer timer = metricService.timer("org.wso2.carbon.metrics.osgi.test.timer", Level.INFO);
    timer.update(1, TimeUnit.SECONDS);
    Assert.assertEquals(timer.getCount(), 1);
}
 
开发者ID:wso2,项目名称:carbon-metrics,代码行数:7,代码来源:MetricsTest.java

示例3: TimerImpl

import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
public TimerImpl(String name, Level level, com.codahale.metrics.Timer timer) {
    super(name, level);
    this.timer = timer;
}
 
开发者ID:wso2,项目名称:carbon-metrics,代码行数:5,代码来源:TimerImpl.java

示例4: ContextImpl

import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
private ContextImpl(com.codahale.metrics.Timer.Context context) {
    this.context = context;
}
 
开发者ID:wso2,项目名称:carbon-metrics,代码行数:4,代码来源:TimerImpl.java

示例5: createMetric

import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
@Override
public TimerImpl createMetric(String name, Level level) {
    return new TimerImpl(name, level, metricRegistry.register(name,
            new com.codahale.metrics.Timer(getReservoir())));
}
 
开发者ID:wso2,项目名称:carbon-metrics,代码行数:6,代码来源:MetricManager.java

示例6: timer

import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
@Override
public Timer timer(String name) throws MetricNotFoundException {
    return metricManager.timer(name);
}
 
开发者ID:wso2,项目名称:carbon-metrics,代码行数:5,代码来源:MetricServiceImpl.java

示例7: TimerInterceptor

import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
private TimerInterceptor(Timer timer) {
    this.timer = timer;
}
 
开发者ID:wso2,项目名称:msf4j,代码行数:4,代码来源:MetricsInterceptor.java

示例8: preCall

import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
@Override
public boolean preCall(Request request, Response responder, ServiceMethodInfo serviceMethodInfo) {
    Timer.Context context = timer.start();
    serviceMethodInfo.setAttribute(TIMER_CONTEXT, context);
    return true;
}
 
开发者ID:wso2,项目名称:msf4j,代码行数:7,代码来源:MetricsInterceptor.java

示例9: postCall

import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
@Override
public void postCall(Request request, int status, ServiceMethodInfo serviceMethodInfo) {
    Timer.Context context = (Timer.Context) serviceMethodInfo.getAttribute(TIMER_CONTEXT);
    context.stop();
}
 
开发者ID:wso2,项目名称:msf4j,代码行数:6,代码来源:MetricsInterceptor.java

示例10: getSourceConnectionTimer

import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
public Timer getSourceConnectionTimer() {
    return sourceConnectionTimer;
}
 
开发者ID:wso2,项目名称:carbon-transports,代码行数:4,代码来源:TimerHolder.java

示例11: getTargetConnectionTimer

import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
public Timer getTargetConnectionTimer() {
    return targetConnectionTimer;
}
 
开发者ID:wso2,项目名称:carbon-transports,代码行数:4,代码来源:TimerHolder.java

示例12: getSourceRequestTimer

import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
public Timer getSourceRequestTimer() {
    return sourceRequestTimer;
}
 
开发者ID:wso2,项目名称:carbon-transports,代码行数:4,代码来源:TimerHolder.java

示例13: getTargetRequestTimer

import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
public Timer getTargetRequestTimer() {
    return targetRequestTimer;
}
 
开发者ID:wso2,项目名称:carbon-transports,代码行数:4,代码来源:TimerHolder.java

示例14: getTargetResponseTimer

import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
public Timer getTargetResponseTimer() {
    return targetResponseTimer;
}
 
开发者ID:wso2,项目名称:carbon-transports,代码行数:4,代码来源:TimerHolder.java

示例15: getSourceResponseTimer

import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
public Timer getSourceResponseTimer() {
    return sourceResponseTimer;
}
 
开发者ID:wso2,项目名称:carbon-transports,代码行数:4,代码来源:TimerHolder.java


注:本文中的org.wso2.carbon.metrics.core.Timer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。