@Override public void close() { mCounter.dec(); } };
/** * Decrement the counter by one. */ public void dec() { dec(1); }
public void invalidate(final String widgetId) { this.cache.remove(widgetId); this.counter.dec(); }
@Override public void decrementCounter(String name, int amount) { if (counters.containsKey(name)) { counters.get(name).dec(amount); } }
@Override public void run() { running.inc(); try { task.run(); } finally { running.dec(); terminated.mark(); } } }
private ChunkEntry getAndCleanupEntry(String id) { final ChunkEntry entry = chunks.remove(id); sortedEvictionSet.remove(entry); waitingMessages.dec(); return entry; }
/** * 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()); } }
@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(); } }
@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(); } }
@Override public void run() { running.inc(); final Timer.Context context = duration.time(); try { command.run(); } finally { context.stop(); running.dec(); completed.mark(); } } }
@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(); } } }
@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(); } } }
@Override public void dec(long n) { super.dec(n); if (this.parentCounter.isPresent()) { this.parentCounter.get().dec(n); } }
/** * 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); }
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()); }
/** * 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; }
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()); }
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { String clientID = NettyUtils.clientID(ctx.channel()); if (clientID != null && !clientID.isEmpty()) { this.connectedClientsMetrics.dec(); } ctx.fireChannelInactive(); }
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); } }
@Override public void sessionDestroyed(HttpSessionEvent se) { Stagemonitor.getMetric2Registry().counter(METRIC_NAME).dec(); } }