@Override public int maximumPoolSize(DataSource dataSource, JsonObject config) { if (dataSource instanceof BoneCPDataSource) { BoneCPConfig cfg = ((BoneCPDataSource) dataSource).getPool().getConfig(); return cfg.getMaxConnectionsPerPartition() * cfg.getPartitionCount(); } return -1; }
this.partitions = new ConnectionPartition[config.getPartitionCount()]; String suffix = ""; this.keepAliveScheduler = Executors.newScheduledThreadPool(config.getPartitionCount(), new CustomThreadFactory("BoneCP-keep-alive-scheduler" + suffix, true)); this.maxAliveScheduler = Executors.newScheduledThreadPool(config.getPartitionCount(), new CustomThreadFactory("BoneCP-max-alive-scheduler" + suffix, true)); this.connectionsScheduler = Executors.newFixedThreadPool(config.getPartitionCount(), new CustomThreadFactory("BoneCP-pool-watch-thread" + suffix, true)); this.partitionCount = config.getPartitionCount(); this.closeConnectionWatch = config.isCloseConnectionWatch(); this.cachedPoolStrategy = config.getPoolStrategy() != null && config.getPoolStrategy().equalsIgnoreCase("CACHED"); for (int p = 0; p < config.getPartitionCount(); p++) {
this.partitions = new ConnectionPartition[config.getPartitionCount()]; String suffix = ""; this.keepAliveScheduler = Executors.newScheduledThreadPool(config.getPartitionCount(), new CustomThreadFactory("BoneCP-keep-alive-scheduler"+suffix, true)); this.maxAliveScheduler = Executors.newScheduledThreadPool(config.getPartitionCount(), new CustomThreadFactory("BoneCP-max-alive-scheduler"+suffix, true)); this.connectionsScheduler = Executors.newFixedThreadPool(config.getPartitionCount(), new CustomThreadFactory("BoneCP-pool-watch-thread"+suffix, true)); this.partitionCount = config.getPartitionCount(); this.closeConnectionWatch = config.isCloseConnectionWatch(); this.cachedPoolStrategy = config.getPoolStrategy() != null && config.getPoolStrategy().equalsIgnoreCase("CACHED"); for (int p=0; p < config.getPartitionCount(); p++){
&& Objects.equal(this.maxConnectionsPerPartition, that.getMaxConnectionsPerPartition()) && Objects.equal(this.minConnectionsPerPartition, that.getMinConnectionsPerPartition()) && Objects.equal(this.partitionCount, that.getPartitionCount()) && Objects.equal(this.releaseHelperThreads, that.getReleaseHelperThreads()) && Objects.equal(this.statementsCacheSize, that.getStatementsCacheSize())