From 3073c185f860ec025c227d73e797ba9d30951f58 Mon Sep 17 00:00:00 2001 From: cpf Date: Wed, 1 Jun 2022 09:05:46 +0800 Subject: [PATCH] check connection by default #401 --- .../java/com/vesoft/nebula/client/graph/net/NebulaPool.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/src/main/java/com/vesoft/nebula/client/graph/net/NebulaPool.java b/client/src/main/java/com/vesoft/nebula/client/graph/net/NebulaPool.java index 490b2081a..0d6e3d90b 100644 --- a/client/src/main/java/com/vesoft/nebula/client/graph/net/NebulaPool.java +++ b/client/src/main/java/com/vesoft/nebula/client/graph/net/NebulaPool.java @@ -106,6 +106,10 @@ public boolean init(List addresses, NebulaPoolConfig config) objConfig.setMinIdle(config.getMinConnSize()); objConfig.setMaxIdle(config.getMaxConnSize()); objConfig.setMaxTotal(config.getMaxConnSize()); + objConfig.setTestOnBorrow(true); + objConfig.setTestOnCreate(true); + objConfig.setTestOnReturn(true); + objConfig.setTestWhileIdle(true); objConfig.setTimeBetweenEvictionRunsMillis(config.getIntervalIdle() <= 0 ? BaseObjectPoolConfig.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS : config.getIntervalIdle());