@Override public Future submit( final Collection<Count> counts ) { return executor.submit( new Callable<Object>() { final TimerContext timer = addTimer.time(); @Override public Object call() throws Exception { cassandraCounterStore.save( counts ); timer.stop(); return true; } } ); }
@Override public Future submit( final Collection<Count> counts ) { return executor.submit( new Callable<Object>() { final TimerContext timer = addTimer.time(); @Override public Object call() throws Exception { // TODO perhaps this could be pushed down further into CountProducer Impl? // - this would leave generic submitter class for ( Count c : counts ) { logger.info( "found count {}", c ); } timer.stop(); return true; } } ); }
public TestAPNsNotification( byte[] token, String payload) { super(token, payload, Calendar.getInstance().getTime()); this.timer = processTimer.time(); }
/** Add a count object to this batcher */ public void add( Count count ) throws CounterProcessingUnavailableException { invocationCounter.inc(); final TimerContext context = addTimer.time(); if ( batchSize == 1 ) { getBatch().addSerial( count ); } else { getBatch().add( count ); } context.stop(); }
TimerContext timerCtx = timer.time();
@Override public Object start(final String tagName) { final Timer timer = metricsRegistry.newTimer(new MetricName(clusterName, TIMER_TYPE, tagName), durationUnit, rateUnit); return timer.time(); }
/** * Starts sink timer. */ public void startSinkTimer() { sinkTimerContext = sinkTimer.time(); }
/** * Start timer. */ public void startTimer() { context = timer.time(); }
private TimerContext startTimer(String name) { if (enableTimers) { final com.yammer.metrics.core.Timer timer = Metrics.newTimer( getClass(), name, TimeUnit.MILLISECONDS, TimeUnit.SECONDS ); TimerContext context = timer.time(); return context; } else { return null; } }
@Override public void connectRequested(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { this.connectStart = System.nanoTime(); this.connectContext = connectTimer.time(); super.connectRequested(ctx, e); }
@Override public Object invoke(MethodInvocation invocation) throws Throwable { final TimerContext ctx = timer.time(); try { return invocation.proceed(); } finally { ctx.stop(); } } }
@Override public Object invoke(MethodInvocation invocation) throws Throwable { final Timer timer = timers.get(invocation.getMethod().getName()); final TimerContext timerCtx = timer != null ? timer.time() : null; try { return invocation.proceed(); } finally { if (timerCtx != null) { timerCtx.stop(); } } }
private TimerContext startTimer(String name) { if (enableTimers) { final com.yammer.metrics.core.Timer timer = Metrics.newTimer(getClass(), name, TimeUnit.MILLISECONDS, TimeUnit.SECONDS); TimerContext context = timer.time(); return context; } else { return null; } }
private static boolean executeAndTimeInsert(PreparedStatement preparedStatement) throws SQLException { TimerContext timerContext = insertTimer.time(); try { return preparedStatement.execute(); } catch (SQLException e) { errorCounter.inc(); throw e; } finally { timerContext.stop(); } }
@Override public void dispatch(Object resource, HttpContext httpContext) { final TimerContext context = timer.time(); try { underlying.dispatch(resource, httpContext); } finally { context.stop(); } } }
@Override public Object start(final String tagName) { final Timer timer = metricsRegistry.newTimer(new MetricName(clusterName, TIMER_TYPE, tagName), durationUnit, rateUnit); return timer.time(); }
public static BufferedImage crop(BufferedImage image, Rectangle bounds) throws Exception { TimerContext cropContext = cropTimer.time(); BufferedImage result = AsyncScalr.crop(image, bounds.x, bounds.y, bounds.width, bounds.height).get(); image.flush(); cropContext.stop(); return result; } }
void awaitDiskSync() { while (segment.lastSyncedOffset < position) { WaitQueue.Signal signal = segment.syncComplete.register(CommitLog.instance.metrics.waitingOnCommit.time()); if (segment.lastSyncedOffset < position) signal.awaitUninterruptibly(); else signal.cancel(); } }
@Override public HttpResponse execute(HttpHost target, HttpRequest request, HttpContext context) throws HttpException, IOException { final TimerContext timerContext = timer(request).time(); try { return super.execute(target, request, context); } finally { timerContext.stop(); } }
public void updateFileStats() { final TimerContext updateTimer = minion.fileStatsTimer.time(); FileStats stats = new FileStats(); stats.update(jobDir); try { LessFiles.write(new File(getConfigDir(), "job.stats"), LessBytes.toBytes(CodecJSON.encodeString(stats)), false); } catch (Exception e) { log.warn("", e); } fileCount = stats.count; fileBytes = stats.bytes; updateTimer.stop(); }