Commit 4e52a56c30221b464cbf9d36f675a60ca8ef2a00
1 parent
d472478d
2022年6月30日18:21:52
Showing
1 changed file
with
3 additions
and
2 deletions
src/main/java/cn/fw/freya/task/DataCaptureTask.java
@@ -16,6 +16,7 @@ import com.alibaba.fastjson.JSONObject; | @@ -16,6 +16,7 @@ import com.alibaba.fastjson.JSONObject; | ||
16 | import lombok.RequiredArgsConstructor; | 16 | import lombok.RequiredArgsConstructor; |
17 | import lombok.extern.slf4j.Slf4j; | 17 | import lombok.extern.slf4j.Slf4j; |
18 | import org.springframework.context.ApplicationEventPublisher; | 18 | import org.springframework.context.ApplicationEventPublisher; |
19 | +import org.springframework.scheduling.annotation.Scheduled; | ||
19 | import org.springframework.stereotype.Component; | 20 | import org.springframework.stereotype.Component; |
20 | import org.springframework.util.CollectionUtils; | 21 | import org.springframework.util.CollectionUtils; |
21 | 22 | ||
@@ -50,7 +51,7 @@ public class DataCaptureTask { | @@ -50,7 +51,7 @@ public class DataCaptureTask { | ||
50 | /** | 51 | /** |
51 | * 每分钟执行多线程同时抓取数据 | 52 | * 每分钟执行多线程同时抓取数据 |
52 | */ | 53 | */ |
53 | - //@Scheduled(cron = "0 0/1 * * * ?") | 54 | + @Scheduled(cron = "0 0/1 * * * ?") |
54 | public void capture() { | 55 | public void capture() { |
55 | final ThreadPoolExecutor threadPoolExecutor = ThreadPoolUtil.getThreadPool(); | 56 | final ThreadPoolExecutor threadPoolExecutor = ThreadPoolUtil.getThreadPool(); |
56 | BlockingQueue<Runnable> queue = threadPoolExecutor.getQueue();// 获取工作队列 | 57 | BlockingQueue<Runnable> queue = threadPoolExecutor.getQueue();// 获取工作队列 |
@@ -96,7 +97,7 @@ public class DataCaptureTask { | @@ -96,7 +97,7 @@ public class DataCaptureTask { | ||
96 | /** | 97 | /** |
97 | * 每2分钟执行抓取数据 | 98 | * 每2分钟执行抓取数据 |
98 | */ | 99 | */ |
99 | - //@Scheduled(fixedRate = 2 * 60 * 1000, initialDelay = 5000) | 100 | + @Scheduled(fixedRate = 2 * 60 * 1000, initialDelay = 5000) |
100 | public void captureLivePlayback() { | 101 | public void captureLivePlayback() { |
101 | Double durationThreshold = 60d;// 设置直播时长阈值 | 102 | Double durationThreshold = 60d;// 设置直播时长阈值 |
102 | final Random random = new Random(); | 103 | final Random random = new Random(); |