定时任务调度多线程任务修改

` ExecutorService executorService = new ThreadPoolExecutor(6, 6,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue(1024), new ThreadFactoryBuilder()
.setNameFormat("assetMonitorExtractor---%d").build(), new ThreadPoolExecutor.AbortPolicy());//Executors.newFixedThreadPool(6);

    List<Runnable> tasks = Arrays.asList(
            () -> {
                // 被动资产实时
                sparkService.monitorAssetPids();
            }, () -> {
                // 被动资产定时
                sparkService.monitorDayPids();
            }, () -> {
                // 告警实时
                sparkService.monitorAlarmPids();
            }, () -> {
                // 异常流实时
                sparkService.monitorEventPids();
            }, () -> {
                // spark监控
                sparkService.monitorSparkPids();
            }, () -> {
                // 一拖N实时
                sparkService.tractorSparkPids();
            });
    tasks.forEach(executorService::submit);
    executorService.shutdown();`

借助arthas进行线程和内存的定位。

posted @ 2022-07-05 14:41  开水白菜  阅读(46)  评论(0编辑  收藏  举报