fix: 断连等待时间过长处理、指令编号同步锁
This commit is contained in:
@@ -232,7 +232,7 @@ public class OpcServerServiceImpl implements OpcServerService, ApplicationAutoIn
|
|||||||
} catch (Exception var4) {
|
} catch (Exception var4) {
|
||||||
this.clearServer(code);
|
this.clearServer(code);
|
||||||
log.warn("写入出错opc server {} 重新加载", code, var4);
|
log.warn("写入出错opc server {} 重新加载", code, var4);
|
||||||
ThreadUtl.sleep(5000L);
|
ThreadUtl.sleep(3000L);
|
||||||
throw var4;
|
throw var4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,13 +42,9 @@ public class OpcUtl {
|
|||||||
Map<Item, Integer> e = null;
|
Map<Item, Integer> e = null;
|
||||||
try {
|
try {
|
||||||
e = group.write(requests);
|
e = group.write(requests);
|
||||||
group.write(requests);
|
// group.write(requests);
|
||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
||||||
try {
|
e1.printStackTrace();
|
||||||
e = group.write(requests);
|
|
||||||
} catch (Exception e2) {
|
|
||||||
e = group.write(requests);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean is_success = true;
|
boolean is_success = true;
|
||||||
@@ -77,7 +73,7 @@ public class OpcUtl {
|
|||||||
log.info("下发信号失败:" + message.toString());
|
log.info("下发信号失败:" + message.toString());
|
||||||
throw new BadRequestException(message.toString());
|
throw new BadRequestException(message.toString());
|
||||||
}
|
}
|
||||||
} catch (JIException arg7) {
|
} catch (Exception arg7) {
|
||||||
log.info("下发信号失败:" + arg7.getMessage());
|
log.info("下发信号失败:" + arg7.getMessage());
|
||||||
System.out.println("下发信号失败原因:" + arg7.getMessage());
|
System.out.println("下发信号失败原因:" + arg7.getMessage());
|
||||||
throw new BadRequestException(arg7.toString());
|
throw new BadRequestException(arg7.toString());
|
||||||
|
|||||||
@@ -8,12 +8,14 @@ import java.util.*;
|
|||||||
|
|
||||||
public class CodeUtil {
|
public class CodeUtil {
|
||||||
|
|
||||||
public static String getNewCode(String ruleCode){
|
public static String getNewCode(String ruleCode) {
|
||||||
String flag = CommonFinalParam.ONE;
|
synchronized (ruleCode) {
|
||||||
HashMap<String,String> map = new HashMap<>();
|
String flag = CommonFinalParam.ONE;
|
||||||
map.put("flag",flag);
|
HashMap<String, String> map = new HashMap<>();
|
||||||
map.put("code",ruleCode);
|
map.put("flag", flag);
|
||||||
return SpringContextHolder.getBean(ISysCodeRuleService.class).codeDemo(map);
|
map.put("code", ruleCode);
|
||||||
|
return SpringContextHolder.getBean(ISysCodeRuleService.class).codeDemo(map);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user