public void run() { recordSample(); } };
/** * Creates a sampled statistic sampling the supplied {@code Statistic} object. * * @param statistic the statistic value to be sampled * @param period the period in seconds between samplings * @param samples the number of samples to store in the history * @param resetOnSample @{code true} if the statistic should be reset after sampling * @return a new sampled statistic */ public synchronized SampledStatistic createSampler(Statistic statistic, int period, int samples, boolean resetOnSample) { SampledStatisticImpl sampler = new SampledStatisticImpl(statistic, samples, resetOnSample); timer.schedule(sampler.getTimerTask(), TimeUnit.SECONDS.toMillis(period), TimeUnit.SECONDS.toMillis(period)); return sampler; }
/** * Destroys a previously created sampled statistic. * <p> * This stops all future sampling for this statistic, and releases all internal references to the statistic. * * @param statistic statistic to be destroyed */ public synchronized void destroySampler(SampledStatistic statistic) { if (statistic instanceof SampledStatisticImpl) { ((SampledStatisticImpl) statistic).getTimerTask().cancel(); } } }
/** * Creates a sampled statistic sampling the supplied {@code Statistic} object. * * @param statistic the statistic value to be sampled * @param period the period in seconds between samplings * @param samples the number of samples to store in the history * @param resetOnSample @{code true} if the statistic should be reset after sampling * @return a new sampled statistic */ public synchronized SampledStatistic createSampler(Statistic statistic, int period, int samples, boolean resetOnSample) { SampledStatisticImpl sampler = new SampledStatisticImpl(statistic, samples, resetOnSample); timer.schedule(sampler.getTimerTask(), TimeUnit.SECONDS.toMillis(period), TimeUnit.SECONDS.toMillis(period)); return sampler; }
/** * Destroys a previously created sampled statistic. * <p> * This stops all future sampling for this statistic, and releases all * internal references to the statistic. * * @param statistic statistic to be destroyed */ public synchronized void destroySampler(SampledStatistic statistic) { if (statistic instanceof SampledStatisticImpl) { ((SampledStatisticImpl) statistic).getTimerTask().cancel(); } } }
/** * Creates a sampled statistic sampling the supplied {@code Statistic} object. * * @param statistic the statistic value to be sampled * @param period the period in seconds between samplings * @param samples the number of samples to store in the history * @param resetOnSample @{code true} if the statistic should be reset after sampling * @return a new sampled statistic */ public synchronized SampledStatistic createSampler(Statistic statistic, int period, int samples, boolean resetOnSample) { SampledStatisticImpl sampler = new SampledStatisticImpl(statistic, samples, resetOnSample); timer.schedule(sampler.getTimerTask(), TimeUnit.SECONDS.toMillis(period), TimeUnit.SECONDS.toMillis(period)); return sampler; }
/** * Destroys a previously created sampled statistic. * <p> * This stops all future sampling for this statistic, and releases all internal references to the statistic. * * @param statistic statistic to be destroyed */ public synchronized void destroySampler(SampledStatistic statistic) { if (statistic instanceof SampledStatisticImpl) { ((SampledStatisticImpl) statistic).getTimerTask().cancel(); } } }
public void run() { recordSample(); } };
public void run() { recordSample(); } };