01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.stats.counter.sampled;
05:
06: /**
07: * Configuration for any given timed counter
08: */
09: public class SampledCounterConfig {
10: private final int intervalSecs;
11: private final int historySize;
12: private final boolean isReset;
13: private final long initialValue;
14:
15: /**
16: * Make a new timed counter config (duh)
17: *
18: * @param intervalSecs the interval (in seconds) between sampling
19: * @param historySize number of counter samples that will be retained in memory
20: * @param isResetOnSample true if the counter should be reset to 0 upon each sample
21: */
22: public SampledCounterConfig(int intervalSecs, int historySize,
23: boolean isResetOnSample, long initialValue) {
24: if (intervalSecs < 1) {
25: throw new IllegalArgumentException("Interval ("
26: + intervalSecs
27: + ") must be greater than or equal to 1");
28: }
29: if (historySize < 1) {
30: throw new IllegalArgumentException("History size ("
31: + historySize
32: + ") must be greater than or equal to 1");
33: }
34:
35: this .intervalSecs = intervalSecs;
36: this .historySize = historySize;
37: this .isReset = isResetOnSample;
38: this .initialValue = initialValue;
39: }
40:
41: public int getHistorySize() {
42: return historySize;
43: }
44:
45: public int getIntervalSecs() {
46: return intervalSecs;
47: }
48:
49: public boolean isResetOnSample() {
50: return this .isReset;
51: }
52:
53: public long getInitialValue() {
54: return this.initialValue;
55: }
56:
57: }
|