|
|
@ -226,20 +226,27 @@ public class InformationCollector implements XMLReadable, XMLWriter { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void sendFunctionsInfo(){ |
|
|
|
private void sendFunctionsInfo(){ |
|
|
|
long currentTime = new Date().getTime(); |
|
|
|
Date current = new Date(); |
|
|
|
|
|
|
|
long lastTime = getLastTimeMillis(); |
|
|
|
|
|
|
|
long currentTime = current.getTime(); |
|
|
|
|
|
|
|
if (currentTime - lastTime <= DELTA) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
ArrayList<Map<String, Object>> content = null; |
|
|
|
ArrayList<Map<String, Object>> content = null; |
|
|
|
content = getFunctionsContentAsByte(currentTime); |
|
|
|
content = getFunctionsContent(current, new Date(lastTime)); |
|
|
|
boolean success = false; |
|
|
|
boolean success = false; |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().info("Start sent function records to the cloud center..."); |
|
|
|
String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); |
|
|
|
String url = CloudCenter.getInstance().acquireUrlByKind(TABLE_FUNCTION_RECORD); |
|
|
|
if(content.size() > 0){ |
|
|
|
if(content.size() > 0){ |
|
|
|
for(int i=0; i<content.size(); i++){ |
|
|
|
for(int i=0; i<content.size(); i++){ |
|
|
|
success = sendFunctionRecord(url, content.get(i)); |
|
|
|
success = sendFunctionRecord(url, content.get(i)); |
|
|
|
} |
|
|
|
} |
|
|
|
//服务器返回true, 说明已经获取成功, 清空当前记录的信息
|
|
|
|
//服务器返回true, 说明已经获取成功, 更新最后一次发送时间
|
|
|
|
if (success) { |
|
|
|
if (success) { |
|
|
|
deleteFunctionRecords(currentTime); |
|
|
|
this.lastTime = dateToString(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().info("Function records successfully sent to the cloud center."); |
|
|
|
// //先将发送压缩文件这段代码注释,之后提任务
|
|
|
|
// //先将发送压缩文件这段代码注释,之后提任务
|
|
|
|
//大数据量下发送压缩zip数据不容易丢失
|
|
|
|
//大数据量下发送压缩zip数据不容易丢失
|
|
|
|
// try {
|
|
|
|
// try {
|
|
|
@ -294,8 +301,8 @@ public class InformationCollector implements XMLReadable, XMLWriter { |
|
|
|
} catch (InterruptedException e) { |
|
|
|
} catch (InterruptedException e) { |
|
|
|
FRContext.getLogger().error(e.getMessage(), e); |
|
|
|
FRContext.getLogger().error(e.getMessage(), e); |
|
|
|
} |
|
|
|
} |
|
|
|
sendFunctionsInfo(); |
|
|
|
|
|
|
|
sendUserInfo(); |
|
|
|
sendUserInfo(); |
|
|
|
|
|
|
|
sendFunctionsInfo(); |
|
|
|
TemplateInfoCollector.getInstance().sendTemplateInfo(); |
|
|
|
TemplateInfoCollector.getInstance().sendTemplateInfo(); |
|
|
|
ErrorInfoUploader.getInstance().sendErrorInfo(); |
|
|
|
ErrorInfoUploader.getInstance().sendErrorInfo(); |
|
|
|
} |
|
|
|
} |
|
|
@ -430,11 +437,11 @@ public class InformationCollector implements XMLReadable, XMLWriter { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static ArrayList getFunctionsContentAsByte(long currentTime){ |
|
|
|
public static ArrayList getFunctionsContent(Date current, Date last){ |
|
|
|
ArrayList<Map<String,Object>> records = new ArrayList<Map<String,Object>>(); |
|
|
|
ArrayList<Map<String,Object>> records = new ArrayList<Map<String,Object>>(); |
|
|
|
QueryCondition condition = QueryFactory.create().addRestriction( |
|
|
|
QueryCondition condition = QueryFactory.create() |
|
|
|
RestrictionFactory.lte(COLUMN_TIME, currentTime) |
|
|
|
.addRestriction(RestrictionFactory.lte(COLUMN_TIME, current)) |
|
|
|
); |
|
|
|
.addRestriction(RestrictionFactory.gte(COLUMN_TIME, last)); |
|
|
|
try { |
|
|
|
try { |
|
|
|
DataList<FocusPoint> focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); |
|
|
|
DataList<FocusPoint> focusPoints = MetricRegistry.getMetric().find(FocusPoint.class,condition); |
|
|
|
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); |
|
|
|
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); |
|
|
@ -459,17 +466,6 @@ public class InformationCollector implements XMLReadable, XMLWriter { |
|
|
|
return records; |
|
|
|
return records; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void deleteFunctionRecords(long currentTime) { |
|
|
|
|
|
|
|
QueryCondition condition = QueryFactory.create().addRestriction( |
|
|
|
|
|
|
|
RestrictionFactory.lte(COLUMN_TIME, currentTime) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
MetricRegistry.getMetric().clean(condition); |
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private class StartStopTime implements XMLReadable, XMLWriter { |
|
|
|
private class StartStopTime implements XMLReadable, XMLWriter { |
|
|
|
|
|
|
|
|
|
|
|
private String startDate; |
|
|
|
private String startDate; |
|
|
|