|
|
@@ -1,5 +1,7 @@
|
|
|
package com.ufo.project.data.task;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -28,7 +30,7 @@ public class DataFileProcessTask
|
|
|
private static final Logger log = LoggerFactory.getLogger(DataFileProcessTask.class);
|
|
|
|
|
|
/** 处理间隔(毫秒), 每轮结束后间隔27秒 */
|
|
|
- private static final long PROCESS_INTERVAL_MILLIS = 17 * 1000L;
|
|
|
+ private static final long PROCESS_INTERVAL_MILLIS = 11 * 1000L;
|
|
|
|
|
|
/** 默认处理器bean名称 */
|
|
|
private static final String DEFAULT_PROCESSER_BEAN = "dataFileProcesserDefaltImpl";
|
|
|
@@ -44,15 +46,18 @@ public class DataFileProcessTask
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- DataFileSyncFiles file = dataFileSyncFilesService.selectFirstPending();
|
|
|
- if (file == null)
|
|
|
+ List<DataFileSyncFiles> files = dataFileSyncFilesService.selectFirstPendings();
|
|
|
+ if (files == null || files.isEmpty())
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- markProcessing(file);
|
|
|
- log.info("[DataFileProcessTask] 开始处理待同步文件, id={}, file={}, handler={}",
|
|
|
- file.getId(), file.getFile(), file.getHandler());
|
|
|
- resolveProcesser(file.getHandler()).execute(file);
|
|
|
+ files.forEach(file ->
|
|
|
+ {
|
|
|
+ markProcessing(file);
|
|
|
+ log.info("[DataFileProcessTask] 开始处理待同步文件, id={}, file={}, handler={}",
|
|
|
+ file.getId(), file.getFile(), file.getHandler());
|
|
|
+ resolveProcesser(file.getHandler()).execute(file);
|
|
|
+ });
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|