This commit is contained in:
@@ -68,11 +68,17 @@ public abstract class PoolTcpSource extends PoolSource<AsyncConnection> {
|
|||||||
long time = System.currentTimeMillis() - 30 * 1000;
|
long time = System.currentTimeMillis() - 30 * 1000;
|
||||||
pollAsync().whenComplete((conn, e) -> {
|
pollAsync().whenComplete((conn, e) -> {
|
||||||
if (e != null) return;
|
if (e != null) return;
|
||||||
if (conn.getLastReadTime() >= time || conn.getLastWriteTime() >= time) return; //半分钟内已经用过
|
if (conn.getLastReadTime() >= time || conn.getLastWriteTime() >= time) {//半分钟内已经用过
|
||||||
|
offerConnection(conn);
|
||||||
|
return;
|
||||||
|
}
|
||||||
CompletableFuture<AsyncConnection> future = sendPingCommand(conn);
|
CompletableFuture<AsyncConnection> future = sendPingCommand(conn);
|
||||||
if (future == null) return; //不支持ping
|
if (future == null) { //不支持ping
|
||||||
|
offerConnection(conn);
|
||||||
|
return;
|
||||||
|
}
|
||||||
future.whenComplete((conn2, e2) -> {
|
future.whenComplete((conn2, e2) -> {
|
||||||
if (e != null) return;
|
if (e2 != null) return;
|
||||||
offerConnection(conn2);
|
offerConnection(conn2);
|
||||||
runPingTask();
|
runPingTask();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user