in src/main/java/com/aliyun/ha3engine/jdbc/Ha3Connection.java [158:180]
public void close() throws SQLException {
if (isClosed()) {
return;
}
synchronized (this) {
statements.clear();
//如果是共用单例client
try {
singletonLock.lock();
CloudClientHolder cloudClientHolder = cloudClientHolders.get(getClientKey());
cloudClientHolder.refDec();
//如果client的持有者都close,对于同一个客户端保留最后的一个,防止重复创建耗费资源
if (ha3Config.isEnableDetailLog()) {
logger.warn("a connection close, key:{}, ref:{}", getClientKey(), cloudClientHolder.refCount());
}
} catch (Exception e) {
logger.error("close ha3 cloud client connection error.", e);
} finally {
singletonLock.unlock();
}
this.active = false;
}
}