org.javasimon.callback.quantiles
Class PropertiesQuantilesCallback

java.lang.Object
  extended by org.javasimon.callback.CallbackSkeleton
      extended by org.javasimon.callback.quantiles.QuantilesCallback
          extended by org.javasimon.callback.quantiles.PropertiesQuantilesCallback
All Implemented Interfaces:
Callback

public class PropertiesQuantilesCallback
extends QuantilesCallback

Callback which stores data in buckets to compute quantiles. Buckets are created from configuration stored in a Properties file. Configuration file should look like:

 # Global default values are set on root
 .min=0
 .max=60000
 .nb=5
 .type=LINEAR
 
 # For org.javasimon group: more buckets
 org.javasimon.nb=10
 
 # SlowClass is a performance bottleneck: higher upper bound
 org.javasimon.slow.SlowClass.max=300000

 # Can use Exponential buckets for some Stopwatches
 org.javasimon.special.type=EXPONENTIAL
 

Author:
gquintana

Nested Class Summary
private  class PropertiesQuantilesCallback.EnumPropertyType<E extends Enum<E>>
          Get enum property for Simon
private  class PropertiesQuantilesCallback.PropertyType<T>
          Base class for property types
 
Nested classes/interfaces inherited from interface org.javasimon.callback.Callback
Callback.Event
 
Field Summary
private  PropertiesQuantilesCallback.EnumPropertyType<BucketsType> bucketsTypeEnumPropertyType
          Get bucket type property for Simon
private  PropertiesQuantilesCallback.PropertyType<Integer> integerPropertyType
          Get integer property for Simon
private  PropertiesQuantilesCallback.PropertyType<Long> longPropertyType
          Get long property for Simon
private  Properties properties
          Properties containing configuration
 
Fields inherited from class org.javasimon.callback.quantiles.QuantilesCallback
ATTR_NAME_BUCKETS
 
Constructor Summary
PropertiesQuantilesCallback(Properties properties)
          Main constructor
 
Method Summary
private static String cleanString(String s)
          Remove space at both ends and convert empty strings to null
protected  Buckets createBuckets(Stopwatch stopwatch)
          Create buckets using callback attributes
private  String getProperty(Simon simon, String name)
          Get property for Simon
 
Methods inherited from class org.javasimon.callback.quantiles.QuantilesCallback
createBuckets, createLogTemplate, getBuckets, getBucketsType, getOrCreateBuckets, isLogEnabled, onSimonReset, onStopwatchAdd, onStopwatchAdd, onStopwatchSplit, onStopwatchSplit, onStopwatchStop, sampleBuckets, setLogEnabled
 
Methods inherited from class org.javasimon.callback.CallbackSkeleton
cleanup, initialize, onCounterDecrease, onCounterIncrease, onCounterSet, onManagerClear, onManagerMessage, onManagerWarning, onSimonCreated, onSimonDestroyed, onStopwatchStart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

properties

private final Properties properties
Properties containing configuration


longPropertyType

private final PropertiesQuantilesCallback.PropertyType<Long> longPropertyType
Get long property for Simon


integerPropertyType

private final PropertiesQuantilesCallback.PropertyType<Integer> integerPropertyType
Get integer property for Simon


bucketsTypeEnumPropertyType

private final PropertiesQuantilesCallback.EnumPropertyType<BucketsType> bucketsTypeEnumPropertyType
Get bucket type property for Simon

Constructor Detail

PropertiesQuantilesCallback

public PropertiesQuantilesCallback(Properties properties)
Main constructor

Parameters:
properties - Properties containing configuration
Method Detail

createBuckets

protected Buckets createBuckets(Stopwatch stopwatch)
Create buckets using callback attributes

Specified by:
createBuckets in class QuantilesCallback
Parameters:
stopwatch - Target stopwatch
Returns:
Created buckets for given stopwatch

getProperty

private String getProperty(Simon simon,
                           String name)
Get property for Simon

Parameters:
simon - Simon
name - Property name
Returns:
Raw property value

cleanString

private static String cleanString(String s)
Remove space at both ends and convert empty strings to null



Copyright © 2013. All Rights Reserved.