/** * 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; }
/** * 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; }
/** * 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; }