本文整理汇总了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();
}
}
示例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);
}
示例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;
}
示例4: ContextImpl
import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
private ContextImpl(com.codahale.metrics.Timer.Context context) {
this.context = context;
}
示例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())));
}
示例6: timer
import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
@Override
public Timer timer(String name) throws MetricNotFoundException {
return metricManager.timer(name);
}
示例7: TimerInterceptor
import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
private TimerInterceptor(Timer timer) {
this.timer = timer;
}
示例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;
}
示例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();
}
示例10: getSourceConnectionTimer
import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
public Timer getSourceConnectionTimer() {
return sourceConnectionTimer;
}
示例11: getTargetConnectionTimer
import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
public Timer getTargetConnectionTimer() {
return targetConnectionTimer;
}
示例12: getSourceRequestTimer
import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
public Timer getSourceRequestTimer() {
return sourceRequestTimer;
}
示例13: getTargetRequestTimer
import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
public Timer getTargetRequestTimer() {
return targetRequestTimer;
}
示例14: getTargetResponseTimer
import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
public Timer getTargetResponseTimer() {
return targetResponseTimer;
}
示例15: getSourceResponseTimer
import org.wso2.carbon.metrics.core.Timer; //导入依赖的package包/类
public Timer getSourceResponseTimer() {
return sourceResponseTimer;
}