修改连接释放

This commit is contained in:
cheney 2022-08-16 09:46:14 +08:00
parent 1806fa8153
commit 81a1170905

View File

@ -73,37 +73,34 @@ public class SydApi4Database implements SydApi {
return this; return this;
} }
void SYD_Disconnect() {
if (null == hsms) {
return;
}
try {
for (int i = 0; i < hsms.length; i++) {
SydApi4j api = hsms[i];
if (null != api) {
try {
api.disconnect();
} catch (Exception e) {
}
}
}
} catch (Exception e){
}
hsms = null;
}
@Override @Override
public void SYD_Disconnect_Ex() { public void SYD_Disconnect_Ex() {
if (isShortLinkMode) { if (isShortLinkMode) {
if (null == hsms) { SYD_Disconnect();
return;
}
LockableObject lockableObject = new LockableObject();
try {
lockableObject.lock();
for (int i = 0; i < hsms.length; i++) {
SydApi4j api = hsms[i];
if (null != api) {
try {
api.disconnect();
} catch (Exception e) {
}
}
}
}
catch (Exception e){
}
finally {
lockableObject.unlock();
}
} }
// 配合链接池不再需要释放 // 配合链接池不再需要释放
} }
@Override @Override