修改短链接
This commit is contained in:
parent
17385b5dec
commit
6949bd4b21
@ -43,8 +43,7 @@ public interface SydApi {
|
||||
* @param iDealTimeOut 交易接口超时设定,单位毫秒(不超过10ms)。
|
||||
* @return SydApi 的对象,只要有设备可用则返回。
|
||||
*/
|
||||
@Deprecated
|
||||
SydApi SYD_Connect_Ex(
|
||||
SydApi SYD_Short_Connect_Ex(
|
||||
String[] pcIpList,
|
||||
int[] iPortList,
|
||||
int iConnectTimeOut,
|
||||
|
||||
@ -28,12 +28,23 @@ public class SydApi4Database implements SydApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SydApi SYD_Connect_Ex(String[] pcIpList, int[] iPortList, int iConnectTimeOut, int iDealTimeOut) {
|
||||
public SydApi SYD_Short_Connect_Ex(String[] pcIpList, int[] iPortList, int iConnectTimeOut, int iDealTimeOut) {
|
||||
if (LogFactory.iLogLevel==3) {
|
||||
log.debug("SYD_Connect_Ex方法接收参数:pcIpList:{},iPortList:{},iConnectTimeOut:{},iDealTimeOut:{}", Arrays.toString(pcIpList), Arrays.toString(iPortList), iConnectTimeOut, iDealTimeOut);
|
||||
}
|
||||
SydApi4j api = (SydApi4j) new SydApi4j().connect(pcIpList[0], iPortList[0], null, iConnectTimeOut);
|
||||
if (iPortList==null||iPortList.length==0){
|
||||
throw new SydApiException("没有ip地址",-1);
|
||||
}
|
||||
if (iPortList.length!=iPortList.length) {
|
||||
throw new SydApiException("ip与端口号数量不一致",-1);
|
||||
}
|
||||
SydApi4j api = null;
|
||||
for (int i = 0; i < pcIpList.length ; i++) {
|
||||
api = (SydApi4j) new SydApi4j().connect(pcIpList[i], iPortList[i], null, iConnectTimeOut);
|
||||
}
|
||||
|
||||
hsms = new SydApi4j[]{api};
|
||||
isShortLinkMode = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -43,14 +54,18 @@ public class SydApi4Database implements SydApi {
|
||||
if ( null == hsms ){
|
||||
return;
|
||||
}
|
||||
|
||||
SydApi4j api = hsms[0];
|
||||
if (null != api) {
|
||||
try {
|
||||
api.disconnect();
|
||||
} catch (Exception e) {
|
||||
SydApi4j api = null;
|
||||
for (int i = 0; i < hsms.length; i++) {
|
||||
api = hsms[i];
|
||||
if (null != api) {
|
||||
try {
|
||||
api.disconnect();
|
||||
} catch (Exception e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
api = null;
|
||||
}
|
||||
// 配合链接池,不再需要释放。
|
||||
@ -124,7 +139,7 @@ public class SydApi4Database implements SydApi {
|
||||
if (LogFactory.iLogLevel==3) {
|
||||
log.debug("SYD_SM4_ShortData方法接收参数:iKeyIndex:{},pcData:{},iFlag:{}", iKeyIndex, Arrays.toString(pcData), iFlag);
|
||||
}
|
||||
if (iFlag==Consts.ECB_DEC&&null==pcData||pcData.length==0){
|
||||
if (iFlag==Consts.ECB_DEC && null==pcData||pcData.length==0){
|
||||
throw new SydApiException(19);
|
||||
}
|
||||
if (null == this.hsms || this.hsms.length < 1) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user