biz.hammurapi.metrics
Class SlicingMeasurementConsumer

java.lang.Object
  extended by biz.hammurapi.metrics.SlicingMeasurementConsumer
All Implemented Interfaces:
Component, MeasurementConsumer

public class SlicingMeasurementConsumer
extends java.lang.Object
implements MeasurementConsumer, Component

Slices metrics.

Version:
$Revision: 1.3 $
Author:
Pavel Vlasov

Field Summary
protected  long from
           
protected  long to
           
 
Constructor Summary
SlicingMeasurementConsumer()
          Default constructor with default settings.
SlicingMeasurementConsumer(long tick, boolean keepMeasurements, int maxQueue, SliceConsumer sliceConsumer)
          Creates a new instance with internal timer.
SlicingMeasurementConsumer(long tick, boolean keepMeasurements, int maxQueue, SliceConsumer sliceConsumer, java.util.Timer timer)
          Creates a new instance with internal timer.
 
Method Summary
 void addMeasurement(java.lang.String name, double value, long time)
          Adds measurement
 MeasurementConsumer getCategoryInstance(java.lang.String category)
           
 int getMaxQueue()
           
protected  SliceConsumer getSliceConsumer()
           
 long getTick()
           
 boolean isKeepMeasurements()
           
 void setKeepMeasurements(boolean keepMeasurements)
           
 void setMaxQueue(int maxQueue)
           
 void setOwner(java.lang.Object owner)
          Plugs the component into container and naming bus.
 void setSliceConsumer(SliceConsumer sliceConsumer)
           
 void setTick(long tick)
           
 void shutdown()
           
 void start()
          Increments use counter
 void stop()
          Decrements use counter and invokes shutdown() when counter==0
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

from

protected long from

to

protected long to
Constructor Detail

SlicingMeasurementConsumer

public SlicingMeasurementConsumer(long tick,
                                  boolean keepMeasurements,
                                  int maxQueue,
                                  SliceConsumer sliceConsumer)
Creates a new instance with internal timer.

Parameters:
tick - Slice size in milliseconds
keepMeasurements - If true individual measurements are reported, only aggregated values otherwise
maxQueue - Maximum number of slices pending to be consumed. 0 - no limit. If sampling ratio is higher than consuming ration then excessive slices will be dropped with a notice on console.

SlicingMeasurementConsumer

public SlicingMeasurementConsumer(long tick,
                                  boolean keepMeasurements,
                                  int maxQueue,
                                  SliceConsumer sliceConsumer,
                                  java.util.Timer timer)
Creates a new instance with internal timer.

Parameters:
tick - Slice size in milliseconds
keepMeasurements - If true individual measurements are reported, only aggregated values otherwise
maxQueue - Maximum number of slices pending to be consumed. 0 - no limit. If sampling ratio is higher than consuming ration then excessive slices will be dropped with a notice on console.
timer - Timer to use for slicing metrics and passing them to slice consumer. If it is null then an internal timer is created.

SlicingMeasurementConsumer

public SlicingMeasurementConsumer()
Default constructor with default settings.

Method Detail

getSliceConsumer

protected SliceConsumer getSliceConsumer()

addMeasurement

public void addMeasurement(java.lang.String name,
                           double value,
                           long time)
Description copied from interface: MeasurementConsumer
Adds measurement

Specified by:
addMeasurement in interface MeasurementConsumer
Parameters:
name - Metric name
value - Measurement value
time - Time when metric was collected. If this parameter is 0 then metric subsystem uses System.currentTimeMillis() to provide correct value if needed.

getCategoryInstance

public MeasurementConsumer getCategoryInstance(java.lang.String category)
Parameters:
category -
Returns:
Instance for a category.

shutdown

public void shutdown()

start

public void start()
           throws ConfigurationException
Increments use counter

Specified by:
start in interface Component
Throws:
ConfigurationException

stop

public void stop()
          throws ConfigurationException
Decrements use counter and invokes shutdown() when counter==0

Specified by:
stop in interface Component
Throws:
ConfigurationException

setOwner

public void setOwner(java.lang.Object owner)
Description copied from interface: Component
Plugs the component into container and naming bus.

Specified by:
setOwner in interface Component

getMaxQueue

public int getMaxQueue()

setMaxQueue

public void setMaxQueue(int maxQueue)

getTick

public long getTick()

setTick

public void setTick(long tick)

setSliceConsumer

public void setSliceConsumer(SliceConsumer sliceConsumer)

isKeepMeasurements

public boolean isKeepMeasurements()

setKeepMeasurements

public void setKeepMeasurements(boolean keepMeasurements)


Copyright © 2003 Hammurapi Group. All Rights Reserved.