暂态原因计算问题
This commit is contained in:
@@ -25,6 +25,8 @@ import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
@@ -42,9 +44,13 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
private final Lock lock = new ReentrantLock();
|
||||
|
||||
@Override
|
||||
public EventAnalysisDTO analysisCauseAndType(EventAnalysisDTO eventAnalysis) {
|
||||
//由于计算原因是异步操作,这里需要加锁不然JNI调用ddl文件会存在内存Invalid memory access
|
||||
lock.lock();
|
||||
try {
|
||||
WaveDataDTO waveDataDTO;
|
||||
String waveName = eventAnalysis.getWaveName();
|
||||
String wlFilePath = eventAnalysis.getWlFilePath();
|
||||
@@ -181,6 +187,9 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
||||
}
|
||||
System.out.println("暂降原因分析完毕===============");
|
||||
System.out.println("cause:" + eventAnalysis);
|
||||
} finally {
|
||||
lock.unlock(); // 释放锁
|
||||
}
|
||||
return eventAnalysis;
|
||||
}
|
||||
|
||||
|
||||
@@ -636,18 +636,16 @@ public class CommMonitorEventReportServiceImpl implements CommMonitorEventReport
|
||||
}
|
||||
}, executor);
|
||||
|
||||
CompletableFuture<List<EventEigDetail>> eigFuture = CompletableFuture.supplyAsync(() ->
|
||||
waveService.eventDetailEigenvalue(index, line.getPtType()), executor
|
||||
);
|
||||
|
||||
// 等待所有异步任务完成并获取结果(无超时,但可加)
|
||||
CompletableFuture<Void> allFutures = CompletableFuture.allOf(instantFuture, rmsFuture, eigFuture);
|
||||
allFutures.join(); // 阻塞直到三个任务都完成
|
||||
CompletableFuture<Void> allFutures = CompletableFuture.allOf(instantFuture, rmsFuture);
|
||||
allFutures.join(); // 阻塞直到2个任务都完成
|
||||
|
||||
// 获取结果(此时所有任务已完成,get()不会阻塞)
|
||||
String imageShun64 = instantFuture.get();
|
||||
String rmsShun64 = rmsFuture.get();
|
||||
List<EventEigDetail> eventDetailEigenvalue = eigFuture.get();
|
||||
List<EventEigDetail> eventDetailEigenvalue = waveService.eventDetailEigenvalue(index, line.getPtType());
|
||||
|
||||
// 主线程顺序调用 WordUtil 方法(保证线程安全)
|
||||
wordUtil.translateShun(index, imageShun64);
|
||||
wordUtil.translateRms(index, rmsShun64);
|
||||
|
||||
@@ -181,7 +181,8 @@ public class EventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper, Rm
|
||||
}else {
|
||||
rmpEventDetailPO.setFileFlag(1);
|
||||
}
|
||||
|
||||
//默认给0,经过高级算法在赋值
|
||||
rmpEventDetailPO.setDealFlag(0);
|
||||
rmpEventDetailPO.setEventDescribe(" ");
|
||||
//如果不为空,说明是二次上传波形文件了;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user