check修改

This commit is contained in:
junj2.liang 2022-08-15 16:33:46 +08:00
parent 9fbebac1ea
commit 5518ffc457
2 changed files with 18 additions and 9 deletions

View File

@ -30,6 +30,10 @@ public class SydApi4Database implements SydApi {
this.hsms = hsms;
}
public SydApi4j[] getHsms() {
return hsms;
}
@Override
public SydApi SYD_Short_Connect_Ex(String[] pcIpList, int[] iPortList, int iConnectTimeOut, int allDealTimeOut) {
Logger log = LogFactory.getLogger();

View File

@ -55,19 +55,24 @@ public class SydApiPool extends ThreadBasedConnectPool<SydApi> {
}
// 保活接口
protected boolean check(SydApi o) {
if ( null == o ) {
protected boolean check(SydApi4Database o) {
if (null==o) {
return false;
}
try {
SydApi4j[] hsms = o.getHsms();
for (SydApi4j hsm : hsms) {
if ( null != hsm ) {
try {
o.SYD_SM3_Hash_ShortData( new byte[8] );
return true;
o.SYD_SM3_Hash_ShortData( new byte[8] );
return true;
}catch ( Exception e) {
// 忽略
return false;
}catch ( Exception e) {
// 忽略
return false;
}
}
}
return false;
}
// 释放