org.apache.flume.instrumentation
Class MonitoredCounterGroup

java.lang.Object
  extended by org.apache.flume.instrumentation.MonitoredCounterGroup
Direct Known Subclasses:
ChannelCounter, ChannelProcessorCounter, SinkCounter, SinkProcessorCounter, SourceCounter

public abstract class MonitoredCounterGroup
extends Object

Used for keeping track of internal metrics using atomic integers

This is used by a variety of component types such as Sources, Channels, Sinks, SinkProcessors, ChannelProcessors, Interceptors and Serializers.


Nested Class Summary
static class MonitoredCounterGroup.Type
          Component Enum Constants Used by each component's constructor to distinguish which type the component is.
 
Constructor Summary
protected MonitoredCounterGroup(MonitoredCounterGroup.Type type, String name, String... attrs)
           
 
Method Summary
protected  long addAndGet(String counter, long delta)
          Atomically adds the delta to the current value for this key
protected  long get(String counter)
          Retrieves the current value for this key
 long getStartTime()
          Returns when this component was first started
 long getStopTime()
          Returns when this component was stopped
 String getType()
           
protected  long increment(String counter)
          Atomically increments the current value for this key by one
protected  void set(String counter, long value)
          Sets the value for this key to the given value
 void start()
          Starts the component Initializes the values for the stop time as well as all the keys in the internal map to zero and sets the start time to the current time in milliseconds since midnight January 1, 1970 UTC
 void stop()
          Shuts Down the Component Used to indicate that the component is shutting down.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MonitoredCounterGroup

protected MonitoredCounterGroup(MonitoredCounterGroup.Type type,
                                String name,
                                String... attrs)
Method Detail

start

public void start()
Starts the component Initializes the values for the stop time as well as all the keys in the internal map to zero and sets the start time to the current time in milliseconds since midnight January 1, 1970 UTC


stop

public void stop()
Shuts Down the Component Used to indicate that the component is shutting down. Sets the stop time and then prints out the metrics from the internal map of keys to values for the following components: - ChannelCounter - ChannelProcessorCounter - SinkCounter - SinkProcessorCounter - SourceCounter


getStartTime

public long getStartTime()
Returns when this component was first started

Returns:

getStopTime

public long getStopTime()
Returns when this component was stopped

Returns:

toString

public final String toString()
Overrides:
toString in class Object

get

protected long get(String counter)
Retrieves the current value for this key

Parameters:
counter - The key for this metric
Returns:
The current value for this key

set

protected void set(String counter,
                   long value)
Sets the value for this key to the given value

Parameters:
counter - The key for this metric
value - The new value for this key

addAndGet

protected long addAndGet(String counter,
                         long delta)
Atomically adds the delta to the current value for this key

Parameters:
counter - The key for this metric
delta -
Returns:
The updated value for this key

increment

protected long increment(String counter)
Atomically increments the current value for this key by one

Parameters:
counter - The key for this metric
Returns:
The updated value for this key

getType

public String getType()


Copyright © 2009-2015 Apache Software Foundation. All Rights Reserved.