mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
bugfix ThreadLocalConnection 多数据源情况下可能存在连接未关闭
This commit is contained in:
parent
c571d7eebb
commit
3a04861f17
@ -46,7 +46,9 @@ public enum ThreadLocalConnection {
|
||||
GroupedConnection groupedConnection = threadLocal.get();
|
||||
if (null != groupedConnection) {
|
||||
groupedConnection.close(ds);
|
||||
threadLocal.remove();
|
||||
if(groupedConnection.removeAble()){
|
||||
threadLocal.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,5 +99,13 @@ public enum ThreadLocalConnection {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 多数据源情况情况下判断是否能从上下文中删除
|
||||
* @return
|
||||
*/
|
||||
public boolean removeAble(){
|
||||
return connMap.size()==0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user