Package org.openbravo.database
Class ExternalConnectionPool
- java.lang.Object
-
- org.openbravo.database.ExternalConnectionPool
-
- Direct Known Subclasses:
JdbcExternalConnectionPool
public abstract class ExternalConnectionPool extends Object
Abstract class that represents an external connection pool
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_POOL
static String
READONLY_POOL
-
Constructor Summary
Constructors Constructor Description ExternalConnectionPool()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
closePool()
If the external connection pool should be closed this method should be overwrittenabstract Connection
getConnection()
Connection
getConnection(String poolName)
This method is intended to be overridden by external connection multi-pools.protected List<Class<? extends Exception>>
getExhaustedExceptions()
Exception
s thrown when trying to create a new connection and pool is exhausted.static ExternalConnectionPool
getInstance()
static ExternalConnectionPool
getInstance(String externalConnectionPoolClassName)
boolean
hasNoConnections(Throwable t)
Checks ifThrowable
was caused by pool not having more connections.void
loadInterceptors(List<PoolInterceptorProvider> interceptors)
If the external connection pool supports interceptors this method should be overwritten
-
-
-
Field Detail
-
DEFAULT_POOL
public static final String DEFAULT_POOL
- See Also:
- Constant Field Values
-
READONLY_POOL
public static final String READONLY_POOL
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static final ExternalConnectionPool getInstance(String externalConnectionPoolClassName) throws ReflectiveOperationException
- Parameters:
externalConnectionPoolClassName
- The full class name of the external connection pool- Returns:
- An instance of the external connection pool
- Throws:
ReflectiveOperationException
-
getInstance
public static final ExternalConnectionPool getInstance()
- Returns:
- the singleton instance of the external connection pool
-
closePool
public void closePool()
If the external connection pool should be closed this method should be overwritten
-
loadInterceptors
public void loadInterceptors(List<PoolInterceptorProvider> interceptors)
If the external connection pool supports interceptors this method should be overwritten- Parameters:
interceptors
- List of PoolInterceptorProvider comprised of all the interceptors injected with Weld
-
getConnection
public abstract Connection getConnection()
- Returns:
- A Connection from the external connection pool
-
getConnection
public Connection getConnection(String poolName)
This method is intended to be overridden by external connection multi-pools. This kind of pools can handle several datasources and this method allows to select from which of them the connection should be taken.- Parameters:
poolName
- The name of the external connection pool- Returns:
- A Connection from the external connection pool whose name is passed as parameter
-
getExhaustedExceptions
protected List<Class<? extends Exception>> getExhaustedExceptions()
Exception
s thrown when trying to create a new connection and pool is exhausted.
-
hasNoConnections
public boolean hasNoConnections(Throwable t)
Checks ifThrowable
was caused by pool not having more connections.
-
-