org.terracotta.counter
Class SampledStatisticManager

java.lang.Object
  extended by org.terracotta.counter.SampledStatisticManager

public class SampledStatisticManager
extends Object

A non-static factory for sampled statistics.

Each instance of the factory creates an independent timer thread that must be shutdown when the statistic manager is no longer needed.


Constructor Summary
SampledStatisticManager()
           
 
Method Summary
 SampledStatistic createSampler(Statistic statistic, int period, int samples, boolean resetOnSample)
          Creates a sampled statistic sampling the supplied Statistic object.
 void destroySampler(SampledStatistic statistic)
          Destroys a previously created sampled statistic.
 void shutdown()
          Shutdown this statistic manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SampledStatisticManager

public SampledStatisticManager()
Method Detail

shutdown

public void shutdown()
Shutdown this statistic manager.

This will trigger the shutdown of the sampling thread used by this statistic manager.


createSampler

public SampledStatistic createSampler(Statistic statistic,
                                      int period,
                                      int samples,
                                      boolean resetOnSample)
Creates a sampled statistic sampling the supplied Statistic object.

Parameters:
statistic - the statistic value to be sampled
period - the period in seconds between samplings
samples - the number of samples to store in the history
resetOnSample - @{code true} if the statistic should be reset after sampling
Returns:
a new sampled statistic

destroySampler

public void destroySampler(SampledStatistic statistic)
Destroys a previously created sampled statistic.

This stops all future sampling for this statistic, and releases all internal references to the statistic.

Parameters:
statistic - statistic to be destroyed


Copyright © 2015 Terracotta, Inc.. All Rights Reserved.