#include <ConnectionPool.h>
Inheritance diagram for ConnectionPool

Public Methods | |
| virtual | ~ConnectionPool () |
| Returns the alias for this pool. More... | |
| const nsAReadableString& | getAlias () |
| Returns the alias for this pool. More... | |
| int | getNumRequests () |
| Returns the number of times a Connection has been checked out from the pool. More... | |
| int | getNumWaits () |
| Returns the number of times a thread has had to block on wait() as a result of all PooledConnections being in use. More... | |
| int | getNumCheckoutTimeouts () |
| Returns the number of times a Connection has been closed by the reapIdleConnections() method due to being checked out for longer than the checkoutSeconds interval. More... | |
| int | getMaxConn () |
| Returns the maximum number of connections this pool can open. More... | |
| int | size () |
| Returns the current number of Connections in the pool. More... | |
| void | reapIdleConnections () |
| Check all connections to make sure they haven't: 1) gone idle for too long 2) been checked out by a thread for too long (cursor leak). More... | |
| void | removeAllConnections () |
| Removes all connections from the pool and calls close() on them. More... | |
| void | removeConnection (Connection* pConn) |
| Connection* | getConnection () |
| Returns a connection for the pool. More... | |
| virtual Connection* | newConnection () = 0 |
| void | returnConnection (Connection* pConn) |
| virtual ConnectionPool* | buildPool (const nsAReadableString& alias) = 0 |
Public Attributes | |
| nsString | m_url |
| nsString | m_username |
| nsString | m_password |
| nsString | m_alias |
Protected Methods | |
| ConnectionPool (const nsAReadableString& alias, const nsAReadableString& url, const nsAReadableString& username, const nsAReadableString& password, int maxConn, int timeoutSeconds, int checkoutSeconds, int maxCheckout = 0) | |
| Creates a Connection pool. More... | |
| void | destroy () |
Private Types | |
| typedef std::vector<Connection*> | vectorConnection |
| typedef std::queue<Thread*> | queueThread |
Private Attributes | |
| vectorConnection | m_connVector |
| queueThread | m_waitingThreads |
| int | m_maxConn |
| int | m_timeoutSeconds |
| int | m_checkoutSeconds |
| int | m_numCheckoutTimeout |
| int | m_numRequests |
| int | m_numWaits |
| int | m_maxCheckout |
| PRLock* | m_mPool |
|
|
Definition at line 25 of file ConnectionPool.h. |
|
|
Definition at line 22 of file ConnectionPool.h. |
|
|
Creates a Connection pool.
Definition at line 51 of file ConnectionPool.cpp. |
|
|
Returns the alias for this pool. This name is defined by the user in the constructor Definition at line 84 of file ConnectionPool.cpp. |
|
|
Reimplemented in ConnectionPoolDB2, ConnectionPoolODBC, ConnectionPoolOracle, and ConnectionPoolSybase. |
|
|
Definition at line 72 of file ConnectionPool.cpp. Referenced by ~ConnectionPool(), and ConnectionPoolODBC::~ConnectionPoolODBC(). |
|
|
Returns the alias for this pool. This name is defined by the user in the constructor Definition at line 93 of file ConnectionPool.cpp. Referenced by ConnectionPoolManager::addAlias(), and ConnectionPoolManager::getPool(). |
|
|
Returns a connection for the pool. There are three ways this can happen:
Definition at line 253 of file ConnectionPool.cpp. Referenced by ConnectionPoolODBC::buildPool(), ConnectionPoolManager::connect(), and px7xpdbc::getConnection(). |
|
|
Returns the maximum number of connections this pool can open.
Definition at line 140 of file ConnectionPool.cpp. |
|
|
Returns the number of times a Connection has been closed by the reapIdleConnections() method due to being checked out for longer than the checkoutSeconds interval.
If this is greater than 0 it means that you either have queries that take longer to execute than the checkoutSeconds interval allows, or it means that you are forgetting to call conn.close() somewhere in your application. Both conditions are undesirable, but they have different solutions. In the latter case either tune your query to execute more quickly, or increase the checkoutSeconds parameter to the pool. In the former case you simply need to find the code that calls DriverManager.getConnection() but not conn.close() Definition at line 132 of file ConnectionPool.cpp. |
|
|
Returns the number of times a Connection has been checked out from the pool.
Definition at line 102 of file ConnectionPool.cpp. |
|
|
Returns the number of times a thread has had to block on wait() as a result of all PooledConnections being in use. Useful diagnostic tool to see if your pool needs more nodes (which could require a database license upgrade if you're running Oracle for instance) Definition at line 113 of file ConnectionPool.cpp. |
|
|
Reimplemented in ConnectionPoolDB2, ConnectionPoolODBC, ConnectionPoolOracle, and ConnectionPoolSybase. Referenced by getConnection(). |
|
|
Check all connections to make sure they haven't: 1) gone idle for too long
Definition at line 159 of file ConnectionPool.cpp. Referenced by ConnectionPoolManager::run(). |
|
|
Removes all connections from the pool and calls close() on them. It squelches any SQLExceptions that might results from close(). That's probably not ideal. Definition at line 189 of file ConnectionPool.cpp. Referenced by ConnectionPoolManager::removeAlias(). |
|
|
Definition at line 203 of file ConnectionPool.cpp. Referenced by reapIdleConnections(), removeAllConnections(), and returnConnection(). |
|
|
Definition at line 292 of file ConnectionPool.cpp. Referenced by Connection::close(). |
|
|
Returns the current number of Connections in the pool.
Definition at line 148 of file ConnectionPool.cpp. |
|
|
Definition at line 32 of file ConnectionPool.h. |
|
|
Definition at line 35 of file ConnectionPool.h. |
|
|
Definition at line 23 of file ConnectionPool.h. |
|
|
Definition at line 37 of file ConnectionPool.h. |
|
|
Definition at line 36 of file ConnectionPool.h. |
|
|
Definition at line 35 of file ConnectionPool.h. |
|
|
Definition at line 35 of file ConnectionPool.h. |
|
|
Definition at line 36 of file ConnectionPool.h. |
|
|
Definition at line 36 of file ConnectionPool.h. |
|
|
Definition at line 31 of file ConnectionPool.h. |
|
|
Definition at line 35 of file ConnectionPool.h. |
|
|
Definition at line 29 of file ConnectionPool.h. |
|
|
Definition at line 30 of file ConnectionPool.h. |
|
|
Definition at line 26 of file ConnectionPool.h. |
1.2.1 written by Dimitri van Heesch,
© 1997-2000