|
|
@ -73,8 +73,6 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable { |
|
|
|
} catch (InvalidClassException ex) { |
|
|
|
} catch (InvalidClassException ex) { |
|
|
|
// 如果 TemplateInfoCollecor 类结构有改动,则放弃之前收集的数据(下次保存时覆盖)
|
|
|
|
// 如果 TemplateInfoCollecor 类结构有改动,则放弃之前收集的数据(下次保存时覆盖)
|
|
|
|
// 这种情况主要在开发、测试过程中遇到,正式上线后不应该出现
|
|
|
|
// 这种情况主要在开发、测试过程中遇到,正式上线后不应该出现
|
|
|
|
FRLogger.getLogger().info(ex.getMessage()); |
|
|
|
|
|
|
|
FRLogger.getLogger().info("use a new instance"); |
|
|
|
|
|
|
|
instance = new TemplateInfoCollector(); |
|
|
|
instance = new TemplateInfoCollector(); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) { |
|
|
|
catch (Exception ex) { |
|
|
@ -123,14 +121,6 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable { |
|
|
|
private void saveInfo() { |
|
|
|
private void saveInfo() { |
|
|
|
try { |
|
|
|
try { |
|
|
|
ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(getInfoFile())); |
|
|
|
ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(getInfoFile())); |
|
|
|
String log = ""; |
|
|
|
|
|
|
|
int count = 1; |
|
|
|
|
|
|
|
for (String key : templateInfoList.keySet()) { |
|
|
|
|
|
|
|
String createTime = ((HashMap)templateInfoList.get(key).get("consumingMap")).get("create_time").toString(); |
|
|
|
|
|
|
|
log += (count + ". id: " + key + " " + createTime + "\n" + templateInfoList.get(key).toString() + "\n"); |
|
|
|
|
|
|
|
count ++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
FRLogger.getLogger().info("writing tplInfo: \n" + log); |
|
|
|
|
|
|
|
os.writeObject(instance); |
|
|
|
os.writeObject(instance); |
|
|
|
os.close(); |
|
|
|
os.close(); |
|
|
|
} catch (Exception ex) { |
|
|
|
} catch (Exception ex) { |
|
|
@ -241,10 +231,7 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable { |
|
|
|
String jsonProcessMap = templateInfo.get("jsonProcessMap"); |
|
|
|
String jsonProcessMap = templateInfo.get("jsonProcessMap"); |
|
|
|
if (sendSingleTemplateInfo(consumingUrl, jsonConsumingMap) && sendSingleTemplateInfo(processUrl, jsonProcessMap)) { |
|
|
|
if (sendSingleTemplateInfo(consumingUrl, jsonConsumingMap) && sendSingleTemplateInfo(processUrl, jsonProcessMap)) { |
|
|
|
// 清空记录
|
|
|
|
// 清空记录
|
|
|
|
FRLogger.getLogger().info("successfully send " + templateInfo.get("templateID")); |
|
|
|
|
|
|
|
removeFromTemplateInfoList(templateInfo.get("templateID")); |
|
|
|
removeFromTemplateInfoList(templateInfo.get("templateID")); |
|
|
|
} else { |
|
|
|
|
|
|
|
FRLogger.getLogger().info("send template info failed, will try next time, " + templateInfo.get("templateID")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
saveInfo(); |
|
|
|
saveInfo(); |
|
|
@ -303,7 +290,6 @@ public class TemplateInfoCollector<T extends IOFile> implements Serializable { |
|
|
|
|
|
|
|
|
|
|
|
private void removeFromTemplateInfoList(String key) { |
|
|
|
private void removeFromTemplateInfoList(String key) { |
|
|
|
templateInfoList.remove(key); |
|
|
|
templateInfoList.remove(key); |
|
|
|
FRLogger.getLogger().info(key + " is removed..."); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|