Class ExternalConnectionPool

  • Direct Known Subclasses:
    JdbcExternalConnectionPool

    public abstract class ExternalConnectionPool
    extends Object
    Abstract class that represents an external connection pool
    • Constructor Detail

      • ExternalConnectionPool

        public ExternalConnectionPool()
    • Method Detail

      • 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()
        Exceptions thrown when trying to create a new connection and pool is exhausted.
      • hasNoConnections

        public boolean hasNoConnections​(Throwable t)
        Checks if Throwable was caused by pool not having more connections.