|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mycore.backend.sql.MCRSQLConnectionPool
public class MCRSQLConnectionPool
This class implements a pool of database connections to a relational database like DB2, using JDBC. Other classes get a connection from the pool when they need one and release the connection after their work has finished.
MCRSQLConnection| Field Summary | |
|---|---|
protected Vector<MCRSQLConnection> |
freeConnections
The internal list of free connections |
(package private) static long |
maxAge
The maximum age a connection can be before it is reconnected |
protected int |
maxNumConnections
The maximum number of connections that will be built |
(package private) static int |
maxUsages
The maximum number of usages of this connection * |
(package private) static String |
password
|
protected static MCRSQLConnectionPool |
singleton
The connection pool singleton |
(package private) static String |
url
|
protected Vector<MCRSQLConnection> |
usedConnections
The internal list of connections that are currently in use |
(package private) static String |
userID
|
| Constructor Summary | |
|---|---|
protected |
MCRSQLConnectionPool()
Builds the connection pool singleton. |
| Method Summary | |
|---|---|
void |
finalize()
Finalizer, closes all connections in this connection pool |
MCRSQLConnection |
getConnection()
Gets a free connection from the pool. |
static MCRSQLConnectionPool |
instance()
Returns the connection pool singleton. |
(package private) void |
releaseConnection(MCRSQLConnection connection)
Releases a connection, indicating that it is not used any more and should be returned to to pool of free connections. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static MCRSQLConnectionPool singleton
protected Vector<MCRSQLConnection> freeConnections
protected Vector<MCRSQLConnection> usedConnections
protected int maxNumConnections
static int maxUsages
static long maxAge
static String url
static String userID
static String password
| Constructor Detail |
|---|
protected MCRSQLConnectionPool()
throws MCRPersistenceException
MCRPersistenceException - if the JDBC driver could not be loaded| Method Detail |
|---|
public static MCRSQLConnectionPool instance()
throws MCRPersistenceException
MCRPersistenceException - if the JDBC driver could not be loaded or initial connections
could not be created
public MCRSQLConnection getConnection()
throws MCRPersistenceException
release() method of the connection.
MCRPersistenceException - if there was a problem while building the connectionMCRSQLConnection.release()void releaseConnection(MCRSQLConnection connection)
release() of the
MCRSQLConnection object.
connection - the connection that has been usedMCRSQLConnection.release()public void finalize()
finalize in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||