本文整理汇总了Java中com.yammer.metrics.core.MetricProcessor类的典型用法代码示例。如果您正苦于以下问题:Java MetricProcessor类的具体用法?Java MetricProcessor怎么用?Java MetricProcessor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MetricProcessor类属于com.yammer.metrics.core包,在下文中一共展示了MetricProcessor类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processWith
import com.yammer.metrics.core.MetricProcessor; //导入依赖的package包/类
@Override
public <T2> void processWith(MetricProcessor<T2> processor, MetricName name, T2 context) throws Exception {
for (T h : _histograms) {
if (h instanceof Metric) {
((Metric) h).processWith(processor, name, context);
}
}
}
示例2: createCounter
import com.yammer.metrics.core.MetricProcessor; //导入依赖的package包/类
static Counter createCounter(long count) throws Exception {
final Counter mock = mock(Counter.class);
when(mock.count()).thenReturn(count);
return configureMatcher(mock, doAnswer(new MetricsProcessorAction() {
@Override
void delegateToProcessor(MetricProcessor<Object> processor, MetricName name, Object context) throws Exception {
processor.processCounter(name, mock, context);
}
}));
}
示例3: createHistogram
import com.yammer.metrics.core.MetricProcessor; //导入依赖的package包/类
static Histogram createHistogram() throws Exception {
final Histogram mock = mock(Histogram.class);
setupSummarizableMock(mock);
setupSamplingMock(mock);
return configureMatcher(mock, doAnswer(new MetricsProcessorAction() {
@Override
void delegateToProcessor(MetricProcessor<Object> processor, MetricName name, Object context) throws Exception {
processor.processHistogram(name, mock, context);
}
}));
}
示例4: createGauge
import com.yammer.metrics.core.MetricProcessor; //导入依赖的package包/类
static Gauge<Object> createGauge(Object value) throws Exception {
@SuppressWarnings("unchecked")
final Gauge<Object> mock = mock(Gauge.class);
when(mock.value()).thenReturn(value);
return configureMatcher(mock, doAnswer(new MetricsProcessorAction() {
@Override
void delegateToProcessor(MetricProcessor<Object> processor, MetricName name, Object context) throws Exception {
processor.processGauge(name, mock, context);
}
}));
}
示例5: createTimer
import com.yammer.metrics.core.MetricProcessor; //导入依赖的package包/类
static Timer createTimer() throws Exception {
final Timer mock = mock(Timer.class);
when(mock.durationUnit()).thenReturn(TimeUnit.MILLISECONDS);
setupSummarizableMock(mock);
setupMeteredMock(mock);
setupSamplingMock(mock);
return configureMatcher(mock, doAnswer(new MetricsProcessorAction() {
@Override
void delegateToProcessor(MetricProcessor<Object> processor, MetricName name, Object context) throws Exception {
processor.processTimer(name, mock, context);
}
}));
}
示例6: createMeter
import com.yammer.metrics.core.MetricProcessor; //导入依赖的package包/类
static Meter createMeter() throws Exception {
final Meter mock = mock(Meter.class);
setupMeteredMock(mock);
return configureMatcher(mock, doAnswer(new MetricsProcessorAction() {
@Override
void delegateToProcessor(MetricProcessor<Object> processor, MetricName name, Object context) throws Exception {
processor.processMeter(name, mock, context);
}
}));
}
示例7: answer
import com.yammer.metrics.core.MetricProcessor; //导入依赖的package包/类
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
@SuppressWarnings("unchecked")
final MetricProcessor<Object> processor = (MetricProcessor<Object>) invocation.getArguments()[0];
final MetricName name = (MetricName) invocation.getArguments()[1];
final Object context = invocation.getArguments()[2];
delegateToProcessor(processor, name, context);
return null;
}
示例8: processWith
import com.yammer.metrics.core.MetricProcessor; //导入依赖的package包/类
@Override
public <T2> void processWith(MetricProcessor<T2> processor, MetricName name, T2 context) throws Exception {
for (T m : _meters) {
m.processWith(processor, name, context);
}
}
示例9: processWith
import com.yammer.metrics.core.MetricProcessor; //导入依赖的package包/类
@Override
public <T> void processWith(MetricProcessor<T> processor, MetricName name, T context) throws Exception {
for (Metric c : _counters)
c.processWith(processor, name, context);
}
示例10: configureMatcher
import com.yammer.metrics.core.MetricProcessor; //导入依赖的package包/类
@SuppressWarnings("unchecked")
static <T extends Metric> T configureMatcher(T mock, Stubber stub) throws Exception {
stub.when(mock).processWith(any(MetricProcessor.class), any(MetricName.class), any());
return mock;
}
示例11: delegateToProcessor
import com.yammer.metrics.core.MetricProcessor; //导入依赖的package包/类
abstract void delegateToProcessor(MetricProcessor<Object> processor, MetricName name, Object context) throws Exception;