|
@@ -2,7 +2,6 @@ package com.css.simulation.resource.util;
|
|
|
|
|
|
import api.common.util.CollectionUtil;
|
|
|
import api.common.util.HttpUtil;
|
|
|
-import api.common.util.JsonUtil;
|
|
|
import api.common.util.LinuxUtil;
|
|
|
import com.css.simulation.resource.scene.mapper.ScoringRulesMapper;
|
|
|
import lombok.SneakyThrows;
|
|
@@ -37,11 +36,13 @@ public class SceneUtil {
|
|
|
@Synchronized
|
|
|
@SneakyThrows
|
|
|
public String callGeneralService(RequestConfig requestConfig, String generalUrl, Map map) {
|
|
|
- String post = HttpUtil.post(HttpUtil.getHttpClient(), requestConfig, generalUrl, null, map);
|
|
|
-
|
|
|
- if (!JsonUtil.readTree(post).get("success").asBoolean()) {
|
|
|
+ String post;
|
|
|
+ try {
|
|
|
+ post = HttpUtil.post(HttpUtil.getHttpClient(), requestConfig, generalUrl, null, map);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("泛化接口服务崩溃,重启。");
|
|
|
LinuxUtil.execute("./service-manager.sh restart", "/root/");
|
|
|
- TimeUnit.SECONDS.sleep(60);
|
|
|
+ TimeUnit.SECONDS.sleep(10);
|
|
|
post = HttpUtil.post(HttpUtil.getHttpClient(), requestConfig, generalUrl, null, map);
|
|
|
}
|
|
|
log.info("调用泛化接口:" + generalUrl + ",响应结果为:" + post);
|