Browse Source

无JIRA任务 屏蔽老的collector

research/10.0
ju 6 years ago
parent
commit
fd7af4ca24
  1. 74
      designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java

74
designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java

@ -212,43 +212,43 @@ public class InformationCollector implements XMLReadable, XMLWriter {
return;
}
byte[] content = ArrayUtils.EMPTY_BYTE_ARRAY;
Connection conn = null;
Table table = new Table(TABLE_NAME);
try {
conn = DBRecordXManager.getDB().createConnection();
ResultSet rs = selectAllFromLogDB(conn, table);
if(rs == null){
return;
}
content = getFunctionsContentAsByte(rs);
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
} finally {
DBUtils.closeConnection(conn);
}
HttpClient httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("functions.info"));
httpClient.setContent(content);
httpClient.setTimeout(5000);
if (!httpClient.isServerAlive()) {
return;
}
String res = httpClient.getResponseText();
boolean success = false;
try {
success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success");
} catch (JSONException e) {
FRContext.getLogger().error(e.getMessage(), e);
}
//服务器返回true, 说明已经获取成功, 清空当前记录的信息
if (success) {
deleteLogDB(conn, table);
}
// byte[] content = ArrayUtils.EMPTY_BYTE_ARRAY;
// Connection conn = null;
// Table table = new Table(TABLE_NAME);
// try {
// conn = DBRecordXManager.getDB().createConnection();
// ResultSet rs = selectAllFromLogDB(conn, table);
//
// if(rs == null){
// return;
// }
// content = getFunctionsContentAsByte(rs);
// } catch (Exception e) {
// FRContext.getLogger().error(e.getMessage(), e);
// } finally {
// DBUtils.closeConnection(conn);
// }
//
// HttpClient httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("functions.info"));
// httpClient.setContent(content);
// httpClient.setTimeout(5000);
//
// if (!httpClient.isServerAlive()) {
// return;
// }
//
// String res = httpClient.getResponseText();
// boolean success = false;
// try {
// success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success");
// } catch (JSONException e) {
// FRContext.getLogger().error(e.getMessage(), e);
// }
// //服务器返回true, 说明已经获取成功, 清空当前记录的信息
// if (success) {
// deleteLogDB(conn, table);
// }
}

Loading…
Cancel
Save