com.netflix.servo.monitor
Class BasicCounter

java.lang.Object
  extended by com.netflix.servo.monitor.AbstractMonitor<java.lang.Number>
      extended by com.netflix.servo.monitor.BasicCounter
All Implemented Interfaces:
Counter, Monitor<java.lang.Number>, NumericMonitor<java.lang.Number>

public final class BasicCounter
extends AbstractMonitor<java.lang.Number>
implements Counter

A simple counter implementation backed by an AtomicLong. The value is the total count for the life of the counter. Observers are responsible for converting to a rate and handling overflows if they occur.


Field Summary
 
Fields inherited from class com.netflix.servo.monitor.AbstractMonitor
config
 
Constructor Summary
BasicCounter(MonitorConfig config)
          Creates a new instance of the counter.
 
Method Summary
 boolean equals(java.lang.Object obj)
          
 java.lang.Number getValue()
          Returns the current value for the monitor.
 int hashCode()
          
 void increment()
          Update the count by one.
 void increment(long amount)
          Update the count by the specified amount.
 java.lang.String toString()
          
 
Methods inherited from class com.netflix.servo.monitor.AbstractMonitor
getConfig
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.netflix.servo.monitor.Monitor
getConfig
 

Constructor Detail

BasicCounter

public BasicCounter(MonitorConfig config)
Creates a new instance of the counter.

Method Detail

increment

public void increment()
Update the count by one.

Specified by:
increment in interface Counter

increment

public void increment(long amount)
Update the count by the specified amount.

Specified by:
increment in interface Counter

getValue

public java.lang.Number getValue()
Returns the current value for the monitor.

Specified by:
getValue in interface Monitor<java.lang.Number>

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object