|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfr.paris.lutece.util.pool.service.ConnectionPool
public class ConnectionPool
This class manages a database connection pool.
Connections are wrapped by a LuteceConnection
to avoid explicit calls to Connection.close()
. Connections
are released to this pool when Connection.close()
is called, and
are not actually closed until release()
call.
LuteceConnection
Constructor Summary | |
---|---|
ConnectionPool(java.lang.String strName,
java.lang.String strUrl,
java.lang.String strUser,
java.lang.String strPassword,
int nMaxConns,
int nInitConns,
int nTimeOut,
org.apache.log4j.Logger logger,
java.lang.String strCheckValidConnectionSql)
Constructor |
Method Summary | ||
---|---|---|
void |
freeConnection(java.sql.Connection conn)
Returns a connection to pool. |
|
int |
getBusyConnectionCount()
Returns the number of busy connections of the pool (available or busy) |
|
java.sql.Connection |
getConnection()
Returns a connection from the pool. |
|
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password)
Returns the connection of the pool |
|
int |
getConnectionCount()
Returns the number of connections opened by the pool (available or busy) |
|
int |
getFreeConnectionCount()
Returns the number of free connections of the pool (available or busy) |
|
int |
getLoginTimeout()
Get loging timeout |
|
java.io.PrintWriter |
getLogWriter()
Get the log |
|
int |
getMaxConnectionCount()
Returns the maximum number of connections of the pool |
|
java.util.logging.Logger |
getParentLogger()
Implementation of JDBC 4.1's getParentLogger method (Java 7) |
|
boolean |
isWrapperFor(java.lang.Class<?> iface)
Get the wrapper |
|
void |
release()
Releases the pool by closing all its connections. |
|
void |
setLoginTimeout(int seconds)
Set Login Timeout |
|
void |
setLogWriter(java.io.PrintWriter out)
Set the log |
|
|
unwrap(java.lang.Class<T> iface)
Get the unwrap |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConnectionPool(java.lang.String strName, java.lang.String strUrl, java.lang.String strUser, java.lang.String strPassword, int nMaxConns, int nInitConns, int nTimeOut, org.apache.log4j.Logger logger, java.lang.String strCheckValidConnectionSql)
strName
- Nom du poolstrUrl
- JDBC Data source URLstrUser
- SQL UserstrPassword
- SQL PasswordnMaxConns
- Max connectionsnInitConns
- Initials connectionsnTimeOut
- Timeout to get a connectionlogger
- the Logger objectstrCheckValidConnectionSql
- The SQL syntax used for check connexion validatationMethod Detail |
---|
public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
- The SQL exceptionpublic void freeConnection(java.sql.Connection conn)
conn
- The released connection to return to poolpublic void release()
public int getConnectionCount()
public int getFreeConnectionCount()
public int getBusyConnectionCount()
public int getMaxConnectionCount()
public java.sql.Connection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
public java.io.PrintWriter getLogWriter() throws java.sql.SQLException
getLogWriter
in interface javax.sql.CommonDataSource
java.sql.SQLException
public void setLogWriter(java.io.PrintWriter out) throws java.sql.SQLException
setLogWriter
in interface javax.sql.CommonDataSource
java.sql.SQLException
public void setLoginTimeout(int seconds) throws java.sql.SQLException
setLoginTimeout
in interface javax.sql.CommonDataSource
java.sql.SQLException
public int getLoginTimeout() throws java.sql.SQLException
getLoginTimeout
in interface javax.sql.CommonDataSource
java.sql.SQLException
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException
unwrap
in interface java.sql.Wrapper
java.sql.SQLException
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException
isWrapperFor
in interface java.sql.Wrapper
java.sql.SQLException
public java.util.logging.Logger getParentLogger()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |