This commit is contained in:
Redkale
2018-07-15 18:11:30 +08:00
parent 03fcf1dc95
commit e8dacd6b70

View File

@@ -102,7 +102,7 @@ public abstract class PoolTcpSource extends PoolSource<AsyncConnection> {
} }
protected CompletableFuture<AsyncConnection> pollAsync(final int count) { protected CompletableFuture<AsyncConnection> pollAsync(final int count) {
if (count >= 3) { if (count >= 5) {
logger.log(Level.WARNING, "create datasource connection error"); logger.log(Level.WARNING, "create datasource connection error");
CompletableFuture<AsyncConnection> future = new CompletableFuture<>(); CompletableFuture<AsyncConnection> future = new CompletableFuture<>();
future.completeExceptionally(new SQLException("create datasource connection error")); future.completeExceptionally(new SQLException("create datasource connection error"));
@@ -119,7 +119,7 @@ public abstract class PoolTcpSource extends PoolSource<AsyncConnection> {
if (!semaphore.tryAcquire()) { if (!semaphore.tryAcquire()) {
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
try { try {
return connQueue.poll(3, TimeUnit.SECONDS); return connQueue.poll(1, TimeUnit.SECONDS);
} catch (Exception t) { } catch (Exception t) {
return null; return null;
} }