de.is24.util.monitoring
Class Counter

java.lang.Object
  extended by de.is24.util.monitoring.Counter
All Implemented Interfaces:
Reportable
Direct Known Subclasses:
Timer

public class Counter
extends Object
implements Reportable

Counters are used to count events. Counters can only be incremented by 1

 Examples :
   number of XYZ errors / Exceptions
   number of handled events
   number of failed events
 

Author:
OSchmitz

Field Summary
private  AtomicLong count
           
private  String fName
           
private static org.apache.log4j.Logger LOGGER
           
 
Constructor Summary
Counter(String name)
          This class is only constructed by InApplicationMonitor
 
Method Summary
 void accept(ReportVisitor aVisitor)
          Implements the visitor pattern to read this Counter
 long getCount()
          get the value of this counter
 String getName()
           
 void increment()
          Increment the value of this counter by one
 void increment(long increment)
          Increase the counter by the specified amount.
 void initialize()
          Initialize with 0
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final org.apache.log4j.Logger LOGGER

fName

private final String fName

count

private final AtomicLong count
Constructor Detail

Counter

Counter(String name)
This class is only constructed by InApplicationMonitor

Parameters:
name - name of this Counter
Method Detail

accept

public void accept(ReportVisitor aVisitor)
Implements the visitor pattern to read this Counter

Specified by:
accept in interface Reportable

increment

public void increment()
Increment the value of this counter by one


increment

public void increment(long increment)

Increase the counter by the specified amount.

Parameters:
increment - the added to add

initialize

public void initialize()
Initialize with 0


getCount

public long getCount()
get the value of this counter

Returns:
current count.

getName

public String getName()
Specified by:
getName in interface Reportable
Returns:
name of this Counter.


Copyright © 2013 Immobilien Scout GmbH. All Rights Reserved.