From 89cc045961477168ac8ff74c5d6604b606214775 Mon Sep 17 00:00:00 2001 From: caishunfeng Date: Fri, 24 Sep 2021 16:19:02 +0800 Subject: [PATCH] [DS-6323][fix] EventExecuteService run loop without sleep which make cpu high (#6324) Co-authored-by: caishunfeng <534328519@qq.com> --- .../server/master/runner/EventExecuteService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/EventExecuteService.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/EventExecuteService.java index 5704175af0..3356842720 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/EventExecuteService.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/EventExecuteService.java @@ -17,6 +17,7 @@ package org.apache.dolphinscheduler.server.master.runner; +import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.StateEvent; import org.apache.dolphinscheduler.common.enums.StateEventType; @@ -36,6 +37,7 @@ import org.apache.commons.lang.StringUtils; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; +import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -104,6 +106,8 @@ public class EventExecuteService extends Thread { try { eventHandler(); + TimeUnit.MILLISECONDS.sleep(Constants.SLEEP_TIME_MILLIS); + } catch (Exception e) { logger.error("Event service thread error", e); }