KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > resource > statistic > pool > JBossManagedConnectionPoolStatistics


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.resource.statistic.pool;
23
24 import java.util.ArrayList JavaDoc;
25 import java.util.Collection JavaDoc;
26 import java.util.Collections JavaDoc;
27 import java.util.Iterator JavaDoc;
28 import java.util.List JavaDoc;
29
30 import org.jboss.resource.statistic.JBossStatistics;
31
32 /**
33  * A JBossManagedConnectionPoolStatistics.
34  *
35  * @author <a HREF="weston.price@jboss.com">Weston Price</a>
36  * @version $Revision: 44968 $
37  */

38 public class JBossManagedConnectionPoolStatistics implements ManagedConnectionPoolStatistics
39 {
40    
41    /** The serialVersionUID */
42    private static final long serialVersionUID = -2962342009092796221L;
43
44    private String JavaDoc poolName;
45
46    private long blockingTimeout;
47    private long idleTimeout;
48    private int min;
49    private int max;
50    private String JavaDoc criteria;
51    private boolean noTxnSeperatePool;
52    
53    private final List JavaDoc subPools;
54
55    private boolean trackByTxn;
56
57    private boolean prefill;
58    
59    public JBossManagedConnectionPoolStatistics(){
60       
61       subPools = new ArrayList JavaDoc();
62    }
63
64    public JBossManagedConnectionPoolStatistics(int subPoolSize){
65       
66       subPools = new ArrayList JavaDoc(subPoolSize);
67    }
68
69    public JBossManagedConnectionPoolStatistics(String JavaDoc poolName){
70       
71       this();
72       this.poolName = poolName;
73       
74    }
75    
76    public void addSubPool(final JBossSubPoolStatistics subPool){
77        
78       subPools.add(subPool);
79    }
80    
81    public Collection JavaDoc getSubPools(){
82       
83       return Collections.unmodifiableCollection(subPools);
84
85    }
86    
87    public long getBlockingTimeout()
88    {
89     
90       return blockingTimeout;
91    
92    }
93    
94    public void setBlockingTimeout(long blockTime){
95       
96       this.blockingTimeout = blockTime;
97             
98    }
99    
100    public String JavaDoc getCriteria()
101    {
102       return this.criteria;
103    }
104    
105    
106    public long getIdleTimeout()
107    {
108       return this.idleTimeout;
109    }
110
111    public void setIdleTimeout(long idleTimeout){
112       
113       this.idleTimeout = idleTimeout;
114       
115    }
116    public int getMax()
117    {
118       return this.max;
119    }
120    
121    public void setMax(int max)
122    {
123       this.max = max;
124    }
125    public int getMin()
126    {
127       return this.min;
128    }
129
130    public void setMin(int min)
131    {
132      this.min = min;
133      
134    }
135    
136    public boolean getNoTxnSeperatePool()
137    {
138       return this.noTxnSeperatePool;
139    }
140    
141    public void setNoTxnSeperatePool(boolean noTxnSeperatePool)
142    {
143       this.noTxnSeperatePool = noTxnSeperatePool;
144    }
145    
146    public JBossManagedConnectionPoolStatistics getStatistics()
147    {
148       
149       return null;
150    }
151
152    public int getSubPoolCount()
153    {
154       return subPools.size();
155
156    }
157
158    public int getTotalConnectionsInUseCount()
159    {
160       int statValue = 0;
161       
162       for(Iterator JavaDoc iter = subPools.iterator(); iter.hasNext();){
163          
164          JBossSubPoolStatistics statGroup = (JBossSubPoolStatistics)iter.next();
165          statValue += statGroup.getConnectionsInUse();
166          
167       }
168       
169       return statValue;
170       
171    }
172
173    public int getTotalMaxConnectionsInUseCount()
174    {
175       
176       int statValue = 0;
177       
178       for(Iterator JavaDoc iter = subPools.iterator(); iter.hasNext();){
179          
180          JBossSubPoolStatistics statGroup = (JBossSubPoolStatistics)iter.next();
181          statValue += statGroup.getMaxConnectionsInUse();
182          
183       }
184       
185       return statValue;
186      
187    }
188
189    public boolean getTrackByTxn()
190    {
191       return this.trackByTxn;
192    }
193    
194    public void setTrackByTxn(boolean trackByTxn)
195    {
196       this.trackByTxn = trackByTxn;
197    
198    }
199    
200    public boolean getPrefill()
201    {
202       // TODO Auto-generated method stub
203
return prefill;
204    }
205
206    public void setPrefill(boolean prefill)
207    {
208       this.prefill = prefill;
209    }
210
211    public String JavaDoc getName()
212    {
213       return this.poolName;
214    }
215
216    public void setName(String JavaDoc name)
217    {
218       this.poolName = name;
219    }
220
221    public void setCriteria(String JavaDoc criteria)
222    {
223      this.criteria = criteria;
224       
225    }
226
227    public void addSubPool(JBossStatistics subPool)
228    {
229       // TODO Auto-generated method stub
230

231    }
232    
233 }
234
Popular Tags