...
|
...
|
@@ -85,10 +85,19 @@ public class JavaApiClient { |
|
|
private CompletionService<JavaApiStatics> completionService;
|
|
|
|
|
|
|
|
|
public static MObjectDetails nullMobject = new MObjectDetails();
|
|
|
|
|
|
@PostConstruct
|
|
|
public void initBean() {
|
|
|
Collections.sort(javaApiHadnlerList);
|
|
|
javaApiHadnlerList.forEach(n -> System.out.println(n.getClass()));
|
|
|
|
|
|
nullMobject.setMoHostIp("0.0.0.0"); //influxdb tag can't null
|
|
|
nullMobject.setMoName("");
|
|
|
nullMobject.setMoId(0);
|
|
|
nullMobject.setMoTags("");
|
|
|
nullMobject.setMoTypeId(0);
|
|
|
nullMobject.setCloudType(0);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -164,7 +173,11 @@ public class JavaApiClient { |
|
|
long startTime = System.currentTimeMillis();
|
|
|
int tastNum = 0;
|
|
|
for (JavaApiInfo javaApiInfo : javaApimap.values()) {
|
|
|
|
|
|
if (javaApiInfo.getApiUrlCustom() == 1) { //自定义url
|
|
|
completionService.submit(new JavaApiTask(restTemplate, javaApiInfo, nullMobject));
|
|
|
tastNum++;
|
|
|
continue;
|
|
|
}
|
|
|
List<MObjectDetails> mObjectInfos = mObjInfoMap.get(javaApiInfo.getServiceType());
|
|
|
if (mObjectInfos == null) {
|
|
|
log.warn("type {} has no service object", javaApiInfo.getServiceType());
|
...
|
...
|
@@ -174,6 +187,7 @@ public class JavaApiClient { |
|
|
completionService.submit(new JavaApiTask(restTemplate, javaApiInfo, mObjectInfo));
|
|
|
tastNum++;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//wait for all rep end...
|
...
|
...
|
@@ -201,12 +215,8 @@ public class JavaApiClient { |
|
|
* @param rep
|
|
|
*/
|
|
|
public void handleResult(JavaApiStatics rep) {
|
|
|
|
|
|
//先做预处理,主要对返回结果格式为{code:200,message:".."}的响应做处理,对code非200的设置异常标志
|
|
|
//顺序处理,先做预处理,主要对返回结果格式为{code:200,message:".."}的响应做处理,对code非200的设置异常标志
|
|
|
javaApiHadnlerList.forEach(handler -> handler.handler(rep));
|
|
|
// for (IJavaApiHadnler javaApiHadnler : javaApiHadnlerList) {
|
|
|
// javaApiHadnler.handler(rep);
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
|