KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > xsocket > stream > IConnectionPool


1 // $Id: BlockingConnection.java 1134 2007-04-05 17:44:43Z grro $
2
/*
3  * Copyright (c) xsocket.org, 2006 - 2007. All rights reserved.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Please refer to the LGPL license at: http://www.gnu.org/copyleft/lesser.txt
20  * The latest copy of this software may be found on http://www.xsocket.org/
21  */

22 package org.xsocket.stream;
23
24 import java.io.IOException JavaDoc;
25
26 /**
27  * a connection pool
28  *
29  * @author grro@xsocket.org
30  */

31 public interface IConnectionPool {
32     
33     
34     /**
35      * destroy the given connection. This connection will not return into the pool. It will be
36      * really closed instead. A leased connection should be destroyed by this way, if it is clear
37      * that the connection has become invalid.
38      *
39      * @param connection the leased connection
40      * @throws IOException if an exception occurs
41      */

42     public void destroyConnection(IConnection connection) throws IOException JavaDoc;
43     
44
45     /**
46      * return the number of max active connections
47      *
48      * @return the number of max active connections
49      */

50     public int getMaxActive();
51     
52     
53     /**
54      * set the number of max active connections
55      *
56      * @param maxActive the number of max active connections
57      */

58     public void setMaxActive(int maxActive);
59     
60     
61     /**
62      * get the max wait time to get a free connection by
63      * calling the getXXXConnection().
64      *
65      * @return the max wait time to get a free connection
66      */

67     public long getMaxWaitMillis();
68
69     
70     /**
71      * set the max wait time to get a free connection by
72      * calling the getXXXConnection().
73      *
74      * @param maxWaitMillis the max wait time to get a free connection
75      */

76     public void setMaxWaitMillis(long maxWaitMillis);
77
78     
79     /**
80      * get the number of max idle connections
81      * @return the number of max idle connections
82      */

83     public int getMaxIdle();
84
85     
86     /**
87      * set the number of max idle connections
88      * @param maxIdle the number of max idle connections
89      */

90     public void setMaxIdle(int maxIdle);
91     
92     
93     /**
94      * get the number of the active (borrowed) connects
95      * @return the number of the active connects
96      */

97     public int getNumActive();
98     
99     
100     /**
101      * get the number of idling connections connections
102      *
103      * @return the number of idling connections connections
104      */

105     public int getNumIdle();
106     
107     
108     /**
109      * get the idle timeout for pooled connections
110      * @return the idle timeout for pooled connections
111      */

112     public long getIdleTimeoutMillis();
113
114     
115     /**
116      * set the idle timeout for pooled connections
117      *
118      * @param idleTimeoutMillis the idle timeout for pooled connections
119      */

120     public void setIdleTimeoutMillis(long idleTimeoutMillis);
121
122     /**
123      * get the life timeout
124      *
125      * @return the life timeout
126      */

127     public long getLifeTimeoutMillis();
128     
129     /**
130      * set the life timeout
131      * @param lifeTimeoutMillis the life timeout
132      */

133     public void setLifeTimeoutMillis(long lifeTimeoutMillis);
134
135         
136     /**
137      * closes the connection pool. All free connection of the pool will be closed
138      *
139      */

140     public void close();
141 }
142
Popular Tags