Coverage Report - com.yammer.metrics.core.NoOpTimer
 
Classes in this File Line Coverage Branch Coverage Complexity
NoOpTimer
0%
0/20
N/A
1
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 
 19  
 package com.yammer.metrics.core;
 20  
 
 21  
 import com.yammer.metrics.stats.Snapshot;
 22  
 
 23  
 import java.util.concurrent.Callable;
 24  
 import java.util.concurrent.TimeUnit;
 25  
 
 26  
 /**
 27  
  * An empty Metrics' Timer implementation that does nothing.
 28  
  */
 29  
 public class NoOpTimer extends Timer {
 30  
   /** singleton instance for everyone to use */
 31  0
   public static final NoOpTimer INSTANCE = new NoOpTimer();
 32  
 
 33  
   /** do not instantiate */
 34  
   private NoOpTimer() {
 35  0
     super(new NoOpExecutorService(), TimeUnit.SECONDS, TimeUnit.SECONDS);
 36  0
   }
 37  
 
 38  
   @Override
 39  0
   public void clear() { }
 40  
 
 41  
   @Override
 42  0
   public void update(long duration, TimeUnit unit) { }
 43  
 
 44  
   @Override
 45  0
   public <T> T time(Callable<T> event) throws Exception { return event.call(); }
 46  
 
 47  
   @Override
 48  0
   public long count() { return 0; }
 49  
 
 50  
   @Override
 51  0
   public double fifteenMinuteRate() { return 0.0; }
 52  
 
 53  
   @Override
 54  0
   public double fiveMinuteRate() { return 0.0; }
 55  
 
 56  
   @Override
 57  0
   public double meanRate() { return 0.0; }
 58  
 
 59  
   @Override
 60  0
   public double oneMinuteRate() { return 0.0; }
 61  
 
 62  
   @Override
 63  0
   public double max() { return 0.0; }
 64  
 
 65  
   @Override
 66  0
   public double min() { return 0.0; }
 67  
 
 68  
   @Override
 69  0
   public double mean() { return 0.0; }
 70  
 
 71  
   @Override
 72  0
   public double stdDev() { return 0.0; }
 73  
 
 74  
   @Override
 75  0
   public double sum() { return 0.0; }
 76  
 
 77  
   @Override
 78  0
   public Snapshot getSnapshot() { return new Snapshot(new double[0]); }
 79  
 
 80  
   @Override
 81  0
   public String eventType() { return ""; }
 82  
 
 83  
   @Override
 84  0
   public void stop() { }
 85  
 
 86  
   @Override
 87  
   public <T> void processWith(MetricProcessor<T> processor, MetricName name,
 88  
                               T context)
 89  0
     throws Exception { }
 90  
 }