%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jcs.engine.stats.CacheStats |
|
|
1 | package org.apache.jcs.engine.stats; |
|
2 | ||
3 | /* |
|
4 | * Licensed to the Apache Software Foundation (ASF) under one |
|
5 | * or more contributor license agreements. See the NOTICE file |
|
6 | * distributed with this work for additional information |
|
7 | * regarding copyright ownership. The ASF licenses this file |
|
8 | * to you under the Apache License, Version 2.0 (the |
|
9 | * "License"); you may not use this file except in compliance |
|
10 | * with the License. You may obtain a copy of the License at |
|
11 | * |
|
12 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
13 | * |
|
14 | * Unless required by applicable law or agreed to in writing, |
|
15 | * software distributed under the License is distributed on an |
|
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
17 | * KIND, either express or implied. See the License for the |
|
18 | * specific language governing permissions and limitations |
|
19 | * under the License. |
|
20 | */ |
|
21 | ||
22 | import org.apache.jcs.engine.stats.behavior.ICacheStats; |
|
23 | import org.apache.jcs.engine.stats.behavior.IStatElement; |
|
24 | import org.apache.jcs.engine.stats.behavior.IStats; |
|
25 | ||
26 | /** |
|
27 | * This class stores cache historical and statistics data for a region. |
|
28 | * |
|
29 | * Only the composite cache knows what the hit count across all auxiliaries is. |
|
30 | * |
|
31 | * @author aaronsm |
|
32 | * |
|
33 | */ |
|
34 | 55796 | public class CacheStats |
35 | extends Stats |
|
36 | implements ICacheStats |
|
37 | { |
|
38 | private static final long serialVersionUID = 529914708798168590L; |
|
39 | ||
40 | 55804 | private String regionName = null; |
41 | ||
42 | 55800 | private IStats[] auxStats = null; |
43 | ||
44 | 55785 | private IStatElement[] stats = null; |
45 | ||
46 | /* |
|
47 | * (non-Javadoc) |
|
48 | * |
|
49 | * @see org.apache.jcs.engine.stats.behavior.ICacheStats#getRegionName() |
|
50 | */ |
|
51 | public String getRegionName() |
|
52 | { |
|
53 | 0 | return regionName; |
54 | } |
|
55 | ||
56 | /* |
|
57 | * (non-Javadoc) |
|
58 | * |
|
59 | * @see org.apache.jcs.engine.stats.behavior.ICacheStats#setRegionName(java.lang.String) |
|
60 | */ |
|
61 | public void setRegionName( String name ) |
|
62 | { |
|
63 | 55808 | regionName = name; |
64 | 55782 | } |
65 | ||
66 | /* |
|
67 | * (non-Javadoc) |
|
68 | * |
|
69 | * @see org.apache.jcs.engine.stats.behavior.ICacheStats#getAuxiliaryCacheStats() |
|
70 | */ |
|
71 | public IStats[] getAuxiliaryCacheStats() |
|
72 | { |
|
73 | 0 | return auxStats; |
74 | } |
|
75 | ||
76 | /* |
|
77 | * (non-Javadoc) |
|
78 | * |
|
79 | * @see org.apache.jcs.engine.stats.behavior.ICacheStats#setAuxiliaryCacheStats(org.apache.jcs.engine.stats.behavior.IAuxiliaryCacheStats[]) |
|
80 | */ |
|
81 | public void setAuxiliaryCacheStats( IStats[] stats ) |
|
82 | { |
|
83 | 55792 | auxStats = stats; |
84 | 55801 | } |
85 | ||
86 | /** |
|
87 | * This returns data about the auxiliaries, such as hit count. Only the |
|
88 | * composite cache knows what the hit count across all auxiliaries is. |
|
89 | * @return IStatElement[] |
|
90 | */ |
|
91 | public IStatElement[] getStatElements() |
|
92 | { |
|
93 | 0 | return stats; |
94 | } |
|
95 | ||
96 | /* |
|
97 | * (non-Javadoc) |
|
98 | * |
|
99 | * @see org.apache.jcs.engine.stats.behavior.IStats#setStatElements(org.apache.jcs.engine.stats.behavior.IStatElement[]) |
|
100 | */ |
|
101 | public void setStatElements( IStatElement[] stats ) |
|
102 | { |
|
103 | 55756 | this.stats = stats; |
104 | 55794 | } |
105 | ||
106 | /* |
|
107 | * (non-Javadoc) |
|
108 | * |
|
109 | * @see java.lang.Object#toString() |
|
110 | */ |
|
111 | public String toString() |
|
112 | { |
|
113 | 55801 | StringBuffer buf = new StringBuffer(); |
114 | ||
115 | 55761 | buf.append( "Region Name = " + regionName ); |
116 | ||
117 | 55738 | if ( stats != null ) |
118 | { |
|
119 | 167381 | for ( int i = 0; i < stats.length; i++ ) |
120 | { |
|
121 | 111479 | buf.append( "\n" ); |
122 | 111585 | buf.append( stats[i] ); |
123 | } |
|
124 | } |
|
125 | ||
126 | 55798 | if ( auxStats != null ) |
127 | { |
|
128 | 166725 | for ( int i = 0; i < auxStats.length; i++ ) |
129 | { |
|
130 | 111397 | buf.append( "\n" ); |
131 | 111396 | buf.append( "---------------------------" ); |
132 | 111423 | buf.append( auxStats[i] ); |
133 | } |
|
134 | } |
|
135 | ||
136 | 55773 | return buf.toString(); |
137 | } |
|
138 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |