|
|
|
@ -90,7 +90,8 @@ public class UpdateService {
|
|
|
|
|
LinkedBlockingDeque<Runnable> workQueue = new LinkedBlockingDeque<>();
|
|
|
|
|
ThreadFactory threadFactory = Executors.defaultThreadFactory();
|
|
|
|
|
ThreadPoolExecutor.CallerRunsPolicy handler = new ThreadPoolExecutor.CallerRunsPolicy();
|
|
|
|
|
ThreadPoolExecutor executor = new ThreadPoolExecutor(corePoolSize,
|
|
|
|
|
ExecutorService patientExecutors = Executors.newFixedThreadPool(corePoolSize);
|
|
|
|
|
ThreadPoolExecutor fileExecutor = new ThreadPoolExecutor(corePoolSize,
|
|
|
|
|
maximumPoolSize,
|
|
|
|
|
keepAliveTime,
|
|
|
|
|
unit,
|
|
|
|
@ -106,7 +107,7 @@ public class UpdateService {
|
|
|
|
|
String picDir = syncDir + File.separator + cardInfo.getId();
|
|
|
|
|
FilePathUtil.mkdirs(picDir);
|
|
|
|
|
|
|
|
|
|
Future patientFuture = executor.submit(() -> {
|
|
|
|
|
Future patientFuture = patientExecutors.submit(() -> {
|
|
|
|
|
try {
|
|
|
|
|
List<Picture> pictures = dataQuery.getPictures(cardInfo.getId());
|
|
|
|
|
if (CollectionUtils.isEmpty(pictures)) {
|
|
|
|
@ -125,7 +126,7 @@ public class UpdateService {
|
|
|
|
|
dataQuery.updatePicPath(cardInfo, lianZhongDir);
|
|
|
|
|
List<Future> fileFutures = new ArrayList<>();
|
|
|
|
|
for (Picture picture : pictures) {
|
|
|
|
|
Future fileFuture = executor.submit(() -> {
|
|
|
|
|
Future fileFuture = fileExecutor.submit(() -> {
|
|
|
|
|
String tifFilePath = lianZhongDir + File.separator + removeFileExtension(picture.getPicname()) + ".tif";
|
|
|
|
|
File tifFile = new File(tifFilePath);
|
|
|
|
|
if (tifFile.exists()) {
|
|
|
|
@ -258,7 +259,8 @@ public class UpdateService {
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
log.error("联众同步数据异常:" + ex.getMessage(), ex);
|
|
|
|
|
} finally {
|
|
|
|
|
executor.shutdown();
|
|
|
|
|
patientExecutors.shutdown();
|
|
|
|
|
fileExecutor.shutdown();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|