KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > resource > pool > api > PoolItemStats


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  * Release: 1.0
21  *
22  * Author: Eric HARDESTY
23  * --------------------------------------------------------------------------
24  * $Id:PoolItemStats.java
25  * --------------------------------------------------------------------------
26  *
27  */

28 package org.objectweb.jonas.resource.pool.api;
29
30 /** <p>This class holds information about each pool entry.
31  *
32  * @author Eric Hardesty
33 **/

34 public class PoolItemStats {
35
36     /**
37      * Max age timeout of the pool item
38      */

39     private long maxAgeTimeout = 0L;
40     /**
41      * Max open timeout of the pool item
42      */

43     private long maxOpenTimeout = 0L;
44     /**
45      * Start time of the pool item
46      */

47     private long startTime = 0L;
48     /**
49      * Total connection time of the pool item
50      */

51     private long totalConnectionTime = 0L;
52
53     /**
54      * number of uses
55      */

56     private int uses = 0;
57
58     /**
59      * Default Constructor
60      */

61     public PoolItemStats() {
62     }
63
64     /**
65      * Get the max age timeout
66      * @return long max age timeout
67      */

68     public long getMaxAgeTimeout() {
69         return maxAgeTimeout;
70     }
71
72     /**
73      * Set the max age timeout
74      * @param pTime long max age timeout
75      */

76     public void setMaxAgeTimeout(long pTime) {
77         maxAgeTimeout = pTime;
78     }
79
80     /**
81      * Get the max open timeout
82      * @return long max open timeout
83      */

84     public long getMaxOpenTimeout() {
85         return maxOpenTimeout;
86     }
87
88     /**
89      * Set the max open timeout
90      * @param pTime long max open timeout
91      */

92     public void setMaxOpenTimeout(long pTime) {
93         maxOpenTimeout = pTime;
94     }
95
96     /**
97      * Get the start time
98      * @return long start time
99      */

100     public long getStartTime() {
101         return startTime;
102     }
103
104     /**
105      * Set the start time
106      * @param pTime long start time
107      */

108     public void setStartTime(long pTime) {
109         startTime = pTime;
110     }
111
112     /**
113      * Get the total connection time
114      * @return long total connection time
115      */

116     public long getTotalConnectionTime() {
117         return totalConnectionTime;
118     }
119
120     /**
121      * Set the total connection time
122      * @param pTime long total connection time
123      */

124     public void setTotalConnectionTime(long pTime) {
125         totalConnectionTime += pTime;
126     }
127
128     /**
129      * Get the number of uses
130      * @return int number of uses
131      */

132     public int getUses() {
133         return uses;
134     }
135
136     /**
137      * Increment the number of uses
138      */

139     public void incrementUses() {
140         uses++;
141     }
142
143     /**
144      * String representing this object
145      * @return String representing the object
146      */

147     public String JavaDoc toString() {
148        String JavaDoc out = "MaxAgeTimeout = " + maxAgeTimeout
149                     + "\nMaxOpenTimeout = " + maxOpenTimeout
150                     + "\nStartTime = " + startTime
151                     + "\nTotalConnectionTime = " + totalConnectionTime
152                     + "\nUses = " + uses;
153        return out;
154     }
155
156 }
Popular Tags