本文整理了Java中com.codahale.metrics.Counter.dec()
方法的一些代码示例,展示了Counter.dec()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Counter.dec()
方法的具体详情如下:
包路径:com.codahale.metrics.Counter
类名称:Counter
方法名:dec
[英]Decrement the counter by one.
[中]将计数器减量1。
代码示例来源:origin: Alluxio/alluxio
@Override
public void close() {
mCounter.dec();
}
};
代码示例来源:origin: io.dropwizard.metrics/metrics-core
/**
* Decrement the counter by one.
*/
public void dec() {
dec(1);
}
代码示例来源:origin: Graylog2/graylog2-server
public void invalidate(final String widgetId) {
this.cache.remove(widgetId);
this.counter.dec();
}
代码示例来源:origin: apache/kylin
@Override
public void decrementCounter(String name, int amount) {
if (counters.containsKey(name)) {
counters.get(name).dec(amount);
}
}
代码示例来源:origin: io.dropwizard.metrics/metrics-core
@Override
public void run() {
running.inc();
try {
task.run();
} finally {
running.dec();
terminated.mark();
}
}
}
代码示例来源:origin: Graylog2/graylog2-server
private ChunkEntry getAndCleanupEntry(String id) {
final ChunkEntry entry = chunks.remove(id);
sortedEvictionSet.remove(entry);
waitingMessages.dec();
return entry;
}
代码示例来源:origin: Alluxio/alluxio
/**
* Resets all the counters to 0 for testing.
*/
public static void resetAllCounters() {
for (Map.Entry<String, Counter> entry : METRIC_REGISTRY.getCounters().entrySet()) {
entry.getValue().dec(entry.getValue().getCount());
}
}
代码示例来源:origin: apache/hive
@Override
public Long decrementCounter(String name, long decrement) {
String key = name;
try {
countersLock.lock();
counters.get(key).dec(decrement);
return counters.get(key).getCount();
} catch(ExecutionException ee) {
throw new IllegalStateException("Error retrieving counter from the metric registry ", ee);
} finally {
countersLock.unlock();
}
}
代码示例来源:origin: apache/kylin
@Override
public Long decrementCounter(String name, long decrement) {
String key = name;
try {
countersLock.lock();
counters.get(key).dec(decrement);
return counters.get(key).getCount();
} catch (ExecutionException ee) {
throw new IllegalStateException("Error retrieving counter from the metric registry ", ee);
} finally {
countersLock.unlock();
}
}
代码示例来源:origin: io.dropwizard.metrics/metrics-core
@Override
public void run() {
running.inc();
final Timer.Context context = duration.time();
try {
command.run();
} finally {
context.stop();
running.dec();
completed.mark();
}
}
}
代码示例来源:origin: io.dropwizard.metrics/metrics-core
@Override
public T call() throws Exception {
running.inc();
final Timer.Context context = duration.time();
try {
return task.call();
} finally {
context.stop();
running.dec();
completed.mark();
}
}
}
代码示例来源:origin: io.dropwizard.metrics/metrics-core
@Override
public T call() throws Exception {
running.inc();
final Timer.Context context = duration.time();
try {
return callable.call();
} finally {
context.stop();
running.dec();
completed.mark();
}
}
}
代码示例来源:origin: apache/incubator-gobblin
@Override
public void dec(long n) {
super.dec(n);
if (this.parentCounter.isPresent()) {
this.parentCounter.get().dec(n);
}
}
代码示例来源:origin: alibaba/jstorm
/**
* flush temp counter data to all windows & assoc metrics.
*/
protected void doFlush() {
long v;
synchronized (unFlushed) {
v = unFlushed.getCount();
}
for (Counter counter : counterMap.values()) {
counter.inc(v);
}
if (MetricUtils.metricAccurateCal) {
for (AsmMetric assocMetric : assocMetrics) {
assocMetric.updateDirectly(v);
}
}
this.unFlushed.dec(v);
}
代码示例来源:origin: thinkaurelius/titan
private void resetEdgeCacheCounts() {
Counter counter = metric.getCounter(metricsPrefix, EDGESTORE_NAME + METRICS_CACHE_SUFFIX, CacheMetricsAction.RETRIEVAL.getName());
counter.dec(counter.getCount());
counter = metric.getCounter(metricsPrefix, EDGESTORE_NAME + METRICS_CACHE_SUFFIX, CacheMetricsAction.MISS.getName());
counter.dec(counter.getCount());
}
代码示例来源:origin: Graylog2/graylog2-server
/**
* Remove the stream assignment from this message.
* @param stream the stream assignment to remove this message from
* @return <tt>true</tt> if this message was assigned to the stream
*/
public boolean removeStream(Stream stream) {
final boolean removed = streams.remove(stream);
if (removed) {
indexSets.clear();
for (Stream s : streams) {
indexSets.add(s.getIndexSet());
}
sizeCounter.dec(8);
if (LOG.isTraceEnabled()) {
LOG.trace("[Message size update][{}] stream removed: {}", getId(), sizeCounter.getCount());
}
}
return removed;
}
代码示例来源:origin: JanusGraph/janusgraph
private void resetEdgeCacheCounts() {
Counter counter = metric.getCounter(metricsPrefix, EDGESTORE_NAME + METRICS_CACHE_SUFFIX, CacheMetricsAction.RETRIEVAL.getName());
counter.dec(counter.getCount());
counter = metric.getCounter(metricsPrefix, EDGESTORE_NAME + METRICS_CACHE_SUFFIX, CacheMetricsAction.MISS.getName());
counter.dec(counter.getCount());
}
代码示例来源:origin: andsel/moquette
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
String clientID = NettyUtils.clientID(ctx.channel());
if (clientID != null && !clientID.isEmpty()) {
this.connectedClientsMetrics.dec();
}
ctx.fireChannelInactive();
}
代码示例来源:origin: apache/hive
private void endFunction(String function, MetaStoreEndFunctionContext context) {
com.codahale.metrics.Timer.Context timerContext = timerContexts.get().remove(function);
if (timerContext != null) {
timerContext.close();
}
Counter counter = Metrics.getOrCreateCounter(MetricsConstants.ACTIVE_CALLS + function);
if (counter != null) {
counter.dec();
}
for (MetaStoreEndFunctionListener listener : endFunctionListeners) {
listener.onEndFunction(function, context);
}
}
代码示例来源:origin: stagemonitor/stagemonitor
@Override
public void sessionDestroyed(HttpSessionEvent se) {
Stagemonitor.getMetric2Registry().counter(METRIC_NAME).dec();
}
}
内容来源于网络,如有侵权,请联系作者删除!