@Override protected Connection getConnectionInternal() throws SQLException { ConnectionHandle result = pollConnection(); // we still didn't find an empty one, wait forever (or as per config) until our partition is free if (result == null) { int partition = (int) (Thread.currentThread().getId() % this.pool.partitionCount); ConnectionPartition connectionPartition = this.pool.partitions[partition]; try { result = connectionPartition.getFreeConnections().poll(this.pool.connectionTimeoutInMs, TimeUnit.MILLISECONDS); if (result == null){ if (this.pool.nullOnConnectionTimeout){ return null; } // 08001 = The application requester is unable to establish the connection. throw new SQLException("Timed out waiting for a free available connection.", "08001"); } } catch (InterruptedException e) { if (this.pool.nullOnConnectionTimeout){ return null; } throw PoolUtil.generateSQLException(e.getMessage(), e); } } return result; }
this.cachedPoolStrategy = config.getPoolStrategy() != null && config.getPoolStrategy().equalsIgnoreCase("CACHED"); if (this.cachedPoolStrategy) { this.connectionStrategy = new CachedConnectionStrategy(this, new DefaultConnectionStrategy(this)); } else { this.connectionStrategy = new DefaultConnectionStrategy(this);
this.cachedPoolStrategy = config.getPoolStrategy() != null && config.getPoolStrategy().equalsIgnoreCase("CACHED"); if (this.cachedPoolStrategy){ this.connectionStrategy = new CachedConnectionStrategy(this, new DefaultConnectionStrategy(this)); } else { this.connectionStrategy = new DefaultConnectionStrategy(this);