KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > quickserver > util > xmlreader > PoolConfig


1 /*
2  * This file is part of the QuickServer library
3  * Copyright (C) 2003-2005 QuickServer.org
4  *
5  * Use, modification, copying and distribution of this software is subject to
6  * the terms and conditions of the GNU Lesser General Public License.
7  * You should have received a copy of the GNU LGP License along with this
8  * library; if not, you can download a copy from <http://www.quickserver.org/>.
9  *
10  * For questions, suggestions, bug-reports, enhancement-requests etc.
11  * visit http://www.quickserver.org
12  *
13  */

14
15 package org.quickserver.util.xmlreader;
16
17 /**
18  * This class encapsulate the pool configuration.
19  * @author Akshathkumar Shetty
20  * @since 1.4.5
21  */

22 public class PoolConfig implements java.io.Serializable JavaDoc {
23     private int maxActive = -1;
24     private int maxIdle = 50;
25     private int initSize = 25;
26
27     /**
28      * Returns the inital size of the pool.
29      * @see #setInitSize
30      * @since 1.4.6
31      */

32     public int getInitSize() {
33         if(maxIdle!=-1 && initSize>maxIdle)
34             return maxIdle;
35         else
36             return initSize;
37     }
38     /**
39      * Sets the inital size of the pool.
40      * XML Tag: &lt;init-size&gt;&lt;/init-size&gt;
41      * @param initSize inital size of the pool.
42      * @see #getInitSize
43      * @since 1.4.6
44      */

45     public void setInitSize(int initSize) {
46         this.initSize = initSize;
47     }
48
49     /**
50      * Returns the maximum active objects allowed in the pool.
51      * @see #setMaxActive
52      */

53     public int getMaxActive() {
54         return maxActive;
55     }
56     /**
57      * Sets the maximum active objects allowed in the pool.
58      * XML Tag: &lt;max-activ&gt;&lt;/max-activ&gt;
59      * @param maxActive maximum allowed active objects
60      * @see #getMaxActive
61      */

62     public void setMaxActive(int maxActive) {
63         this.maxActive = maxActive;
64     }
65
66     /**
67      * Returns the maximum idle objects allowed in the pool.
68      * @see #setMaxIdle
69      */

70     public int getMaxIdle() {
71         return maxIdle;
72     }
73     /**
74      * Sets the maximum Idle objects allowed in the pool.
75      * XML Tag: &lt;max-idle&gt;&lt;/max-idle&gt;
76      * @param maxIdle maximum allowed active objects
77      * @see #getMaxIdle
78      */

79     public void setMaxIdle(int maxIdle) {
80         this.maxIdle = maxIdle;
81     }
82 }
83
Popular Tags