check修改

This commit is contained in:
junj2.liang 2022-08-16 09:47:30 +08:00
parent 1806fa8153
commit cb4d171c24
2 changed files with 10 additions and 5 deletions

View File

@ -161,7 +161,6 @@ public class SydApi4Database implements SydApi {
if (null == this.hsms || this.hsms.length < 1) { if (null == this.hsms || this.hsms.length < 1) {
throw new SydApiException(-1); throw new SydApiException(-1);
} }
byte[] procData = null; byte[] procData = null;
if (2 == iPkgNum || 3 == iPkgNum) { if (2 == iPkgNum || 3 == iPkgNum) {
procData = Util.hexString2Bytes(pcProcData); procData = Util.hexString2Bytes(pcProcData);
@ -169,6 +168,9 @@ public class SydApi4Database implements SydApi {
} }
SydApiException le = null; SydApiException le = null;
LockableObject lockableObject = new LockableObject();
lockableObject.lock();
try {
for (SydApi4j api : this.hsms) { for (SydApi4j api : this.hsms) {
if (null == api) { if (null == api) {
continue; continue;
@ -190,6 +192,13 @@ public class SydApi4Database implements SydApi {
throw e; throw e;
} }
} }
}
catch (Exception e){
}
finally {
lockableObject.unlock();
}
throw le; throw le;
} }

View File

@ -69,16 +69,12 @@ public class SydApiPool extends ThreadBasedConnectPool<SydApi> {
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
if (null != hsms[i]) { if (null != hsms[i]) {
try { try {
l.lock();
o.SYD_SM3_Hash_ShortData(new byte[8]); o.SYD_SM3_Hash_ShortData(new byte[8]);
ifBoolean = true; ifBoolean = true;
} catch (Exception e) { } catch (Exception e) {
// 忽略 // 忽略
hsms[i] = null; hsms[i] = null;
} }
finally {
l.unlock();
}
} }
} }
return ifBoolean; return ifBoolean;