APISonar


com.yammer.metrics.core.Timer.time

> com > yammer > metrics > core > Timer > time
com APIs yammer APIs metrics APIs core APIs Timer APIs time APIs

Example 1
public Object start(final String tagName) {
    final Timer timer = metricsRegistry.newTimer(new MetricName(clusterName, TIMER_TYPE, tagName),
        durationUnit, rateUnit);
    return timer.time();
  }
Example 2
private final Timer _totalSearchTimer;

    public RESULT handleRequest(final REQUEST request) throws Exception {
        return _totalSearchTimer.time(new Callable<RESULT>(){

            @Override
            public RESULT call() throws Exception {
                return _svc.execute(request);
            }
        });
    }
Example 3
private static Timer timer = Metrics.newTimer(new MetricName(PurgeUnusedActivitiesJob.class, "purgeUnusedActivityIndexes"), TimeUnit.MILLISECONDS, TimeUnit.SECONDS);

  public void run()  {    
    try {
      timer.time(new Callable<Integer>() {
        @Override
        public Integer call() throws Exception {        
          return purgeUnusedActivityIndexes();
        }       
      });
    } catch (Exception e) {
      logger.error(e.getMessage(), e);
    }
  }
Example 4
private final Timer addTimer =
            Metrics.newTimer( CassandraSubmitter.class, "submit_invocation", TimeUnit.MICROSECONDS, TimeUnit.SECONDS );

    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;
            }
        } );
    }
Example 5
private final Timer processTimer  =
            Metrics.newTimer(TestAPNsNotification.class, "apns_test_notification", TimeUnit.MICROSECONDS, TimeUnit.SECONDS);

    public TestAPNsNotification( byte[] token, String payload) {
        super(token, payload, Calendar.getInstance().getTime());
        this.timer = processTimer.time();
    }
Example 6
private final Timer addTimer =
            Metrics.newTimer( AbstractBatcher.class, "add_invocation", TimeUnit.MICROSECONDS, TimeUnit.SECONDS );

    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();
    }