|
@@ -58,7 +58,16 @@ public class TrainFileModeService {
|
|
|
//控制太输出信息队列
|
|
|
BlockingQueue<TrainInfo> infoQueue = new LinkedBlockingQueue<TrainInfo>();
|
|
|
//零时保存模型队列
|
|
|
- BlockingQueue<Diagnosetrainhistory> historyQueue = new LinkedBlockingQueue<Diagnosetrainhistory>();
|
|
|
+// BlockingQueue<Diagnosetrainhistory> historyQueue = new LinkedBlockingQueue<Diagnosetrainhistory>();
|
|
|
+ private Diagnosetrainhistory historyQueue =null;
|
|
|
+
|
|
|
+ public Diagnosetrainhistory getHistoryQueue() {
|
|
|
+ return historyQueue;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setHistoryQueue(Diagnosetrainhistory historyQueue) {
|
|
|
+ this.historyQueue = historyQueue;
|
|
|
+ }
|
|
|
|
|
|
public void exec(String name, String forecastLabel, String[] inputLabel, String host, MultipartFile file) {
|
|
|
|
|
@@ -144,16 +153,11 @@ public class TrainFileModeService {
|
|
|
* @param history
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
- public void putDiagnosetrainhistory(String history) throws Exception {
|
|
|
-
|
|
|
+ public void putDiagnosetrainhistory(String history){
|
|
|
String body = JSONObject.toJSONString(history);
|
|
|
Object historys = JSONObject.parse(body);
|
|
|
- Diagnosetrainhistory d = JSONObject.parseObject(historys.toString(), Diagnosetrainhistory.class);
|
|
|
- d.setEnable(false);
|
|
|
- diagnosetrainhistoryService.insertItem(d);
|
|
|
- Diagnosetrainhistory dbhistory = diagnosetrainhistoryService.getHistoryByCode(d.getCode());
|
|
|
- historyQueue.put(dbhistory);
|
|
|
-
|
|
|
+ historyQueue= JSONObject.parseObject(historys.toString(), Diagnosetrainhistory.class);
|
|
|
+ historyQueue.setEnable(false);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -165,10 +169,8 @@ public class TrainFileModeService {
|
|
|
public Diagnosetrainhistory consumeHistory() throws Exception {
|
|
|
Diagnosetrainhistory d = null;
|
|
|
try {
|
|
|
- if (historyQueue.size() > 0) {
|
|
|
- d = historyQueue.take();
|
|
|
- }
|
|
|
- } catch (InterruptedException e) {
|
|
|
+ d = historyQueue;
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return d;
|