Class JdbcExternalConnectionPool
- java.lang.Object
-
- org.openbravo.database.ExternalConnectionPool
-
- org.openbravo.apachejdbcconnectionpool.JdbcExternalConnectionPool
-
public class JdbcExternalConnectionPool extends ExternalConnectionPool
JdbcExternalConnectionPool manages all the functionality of the Apache JDBC Connection Pool. This class can handle different pools (data sources) at the same time. All these pools are eventually making use of the Apache JDBC Connection Pool. This class provides convenience methods to get a connection from a pool, close the different pools and other actions.
-
-
Field Summary
-
Fields inherited from class org.openbravo.database.ExternalConnectionPool
DEFAULT_POOL, READONLY_POOL
-
-
Constructor Summary
Constructors Constructor Description JdbcExternalConnectionPool()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closePool()
This method closes all the data sources retrieved from the Apache JDBC Connection Pool.Connection
getConnection()
This method provides a connection from the default pool.Connection
getConnection(String poolName)
This method provides a connection from the pool whose name is specified as parameter.org.apache.tomcat.jdbc.pool.DataSource
getDataSource()
Gets the default data source, which was obtained from the Apache JDBC Connection Pool.protected List<Class<? extends Exception>>
getExhaustedExceptions()
Exception
s thrown when trying to create a new connection and pool is exhausted.void
loadInterceptors(List<PoolInterceptorProvider> interceptors)
This method loads all the interceptors of Apache JDBC Connection Pool injected with weld.-
Methods inherited from class org.openbravo.database.ExternalConnectionPool
getInstance, getInstance, hasNoConnections
-
-
-
-
Method Detail
-
loadInterceptors
public void loadInterceptors(List<PoolInterceptorProvider> interceptors)
This method loads all the interceptors of Apache JDBC Connection Pool injected with weld.- Overrides:
loadInterceptors
in classExternalConnectionPool
- Parameters:
interceptors
- List of PoolInterceptorProvider comprised of all the interceptors injected with Weld
-
getDataSource
public org.apache.tomcat.jdbc.pool.DataSource getDataSource()
Gets the default data source, which was obtained from the Apache JDBC Connection Pool.- Returns:
- the
DataSource
of the default pool
-
getConnection
public Connection getConnection()
This method provides a connection from the default pool. The connection pool is initialized in the first call to this method. aConnection
retrieved from the default pool- Specified by:
getConnection
in classExternalConnectionPool
- Returns:
- A Connection from the external connection pool
-
getConnection
public Connection getConnection(String poolName)
This method provides a connection from the pool whose name is specified as parameter. The connection pool is initialized in the first call to this method.- Overrides:
getConnection
in classExternalConnectionPool
- Parameters:
poolName
- the name of the pool used to retrieve the connection- Returns:
- a
Connection
retrieved from the pool passed as parameter
-
closePool
public void closePool()
This method closes all the data sources retrieved from the Apache JDBC Connection Pool.- Overrides:
closePool
in classExternalConnectionPool
-
getExhaustedExceptions
protected List<Class<? extends Exception>> getExhaustedExceptions()
Description copied from class:ExternalConnectionPool
Exception
s thrown when trying to create a new connection and pool is exhausted.- Overrides:
getExhaustedExceptions
in classExternalConnectionPool
-
-