KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > smartlib > pool > core > PoolManager


1 /*
2  * @(#) PoolManager 1.0 02/08/01
3  */

4
5
6 package org.smartlib.pool.core;
7
8 import java.sql.*;
9
10 /**
11  * This interface defines the behavior of the class that will manage
12  * various pools and provide a single access point to the pools.
13  *
14  * @author Sachin Shekar Shetty
15  * @version 1.0, 02/08/01
16  */

17
18 public interface PoolManager {
19
20     /**
21      * This method returns a Connection from the default connection pool.
22      * The owner of this pool is marked as N/A indicating unknown.
23      *
24      * <b>Note: This method blocks if the pool size has reached it's
25      * maximum size and no free connections are available
26      * until a free connection is available.</b> The time period for which this
27      * method blocks depends on the connection-wait-time-out specified in
28      * the configuration file.
29      *
30      *
31      *
32      * @return Connection from the default pool
33      * @exception ConnectionPoolException if there is any problem
34      * getting connection.
35      */

36     public Connection getConnection()
37         throws ConnectionPoolException;
38
39
40     /**
41      * This method returns a Connection from the pool <code>poolName</code>.
42      * The owner of this pool is marked as N/A indicating unknown.
43      *
44      * <b>Note: This method blocks if the pool size has reached it's
45      * maximum size and no free connections are available
46      * until a free connection is available.</b> The time period for which this
47      * method blocks depends on the connection-wait-time-out specified in
48      * the configuration file.
49      *
50      *
51      * @param poolName Name of the pool.
52      * @return Connection from the pool
53      * @exception ConnectionPoolException if there is any problem
54      * getting connection.
55      */

56     public Connection getConnection(String JavaDoc poolName)
57         throws ConnectionPoolException;
58
59
60     /**
61      * This method returns a Connection from the pool <code>poolName</code>.
62      * The owner of this connection is identified by <code>owner</code> .
63      *
64      * <b>Note: This method blocks if the pool size has reached it's
65      * maximum size and no free connections are available
66      * until a free connection is available.</b> The time period for which this
67      * method blocks depends on the connection-wait-time-out specified in
68      * the configuration file.
69      *
70      * @param poolName Name of the pool.
71      * @param owner String identifying the owner.
72      * @return Connection from the pool
73      *
74      * @exception ConnectionPoolException if there is any problem
75      * getting connection.
76      */

77
78     public Connection getConnection(String JavaDoc poolName, String JavaDoc owner)
79         throws ConnectionPoolException;
80
81     /**
82      * This method adds a connection leak listener.The methods of
83      * <code>cle</code> will be called when a leak is detected as per the
84      * pool configuration.
85      *
86      * @param poolName Name of the pool.
87      * @param cle Class implementing ConnectionLeakListener interface.
88      * @exception ConnectionPoolException If there is any problem
89      * adding ConnectionLeakListener.
90      */

91     public void addConnectionLeakListener(String JavaDoc poolName,
92             ConnectionLeakListener cle) throws ConnectionPoolException;
93
94             
95     /**
96      * This method removes a connection leak listener.<code>cle</code> will
97      * not get any further notifications.
98      *
99      * @param poolName Name of the pool.
100      * @param cle Class implementing ConnectionLeakListener interface.
101      * @exception ConnectionPoolException If there is any problem
102      * removing ConnectionLeakListener.
103      */

104     public void removeConnectionLeakListener(String JavaDoc poolName,
105             ConnectionLeakListener cle) throws ConnectionPoolException;
106
107
108     /**
109      * This method returns the instance of PoolMonitor for the pool
110      * <code>poolName</code>
111      *
112      * @param poolName Name of the pool.
113      * @return PoolMonitor interface to monitor the state of the pool
114      * @exception ConnectionPoolException
115      *
116      */

117     public MultiPoolMonitor getMultiPoolMonitor(String JavaDoc poolName)
118         throws ConnectionPoolException;
119
120     /**
121      * This method shutsdown all the pools
122      */

123     public void shutDown();
124
125
126 }
127
Popular Tags