diff --git a/saturn-core/src/main/java/com/vip/saturn/job/executor/InitNewJobService.java b/saturn-core/src/main/java/com/vip/saturn/job/executor/InitNewJobService.java index a3bd02b04..ec6a68cfe 100644 --- a/saturn-core/src/main/java/com/vip/saturn/job/executor/InitNewJobService.java +++ b/saturn-core/src/main/java/com/vip/saturn/job/executor/InitNewJobService.java @@ -11,6 +11,7 @@ import com.vip.saturn.job.reg.base.CoordinatorRegistryCenter; import com.vip.saturn.job.threads.SaturnThreadFactory; import com.vip.saturn.job.utils.AlarmUtils; +import com.vip.saturn.job.utils.SystemEnvProperties; import org.apache.commons.lang3.StringUtils; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.recipes.cache.ChildData; @@ -178,8 +179,10 @@ private boolean initJobScheduler(String jobName) { JOB_INIT_FAILED_RECORDS.get(executorName).get(jobName).clear(); return true; } catch (JobInitAlarmException e) { - // no need to log exception stack as it should be logged in the original happen place - raiseAlarmForJobInitFailed(jobName, e); + if (!SystemEnvProperties.VIP_SATURN_DISABLE_JOB_INIT_FAILED_ALARM) { + // no need to log exception stack as it should be logged in the original happen place + raiseAlarmForJobInitFailed(jobName, e); + } } catch (Throwable t) { log.warn(String.format(SaturnConstant.LOG_FORMAT_FOR_STRING, jobName, "job initialize failed, but will not stop the init process"), t); diff --git a/saturn-core/src/main/java/com/vip/saturn/job/utils/SystemEnvProperties.java b/saturn-core/src/main/java/com/vip/saturn/job/utils/SystemEnvProperties.java index 430c6d481..443e5e87b 100644 --- a/saturn-core/src/main/java/com/vip/saturn/job/utils/SystemEnvProperties.java +++ b/saturn-core/src/main/java/com/vip/saturn/job/utils/SystemEnvProperties.java @@ -99,6 +99,12 @@ public class SystemEnvProperties { public static int VIP_SATURN_CONNECTION_TIMEOUT_IN_SECONDS_IN_UNSTABLE_NETWORK = 40; public static int VIP_SATURN_RETRY_TIMES_IN_UNSTABLE_NETWORK = 9; + // switch for disable job init failed alarm, false by default + private static final String NAME_VIP_SATURN_DISABLE_JOB_INIT_FAILED_ALARM = "VIP_SATURN_DISABLE_JOB_INIT_FAILED_ALARM"; + public static boolean VIP_SATURN_DISABLE_JOB_INIT_FAILED_ALARM = Boolean.parseBoolean( + System.getProperty(NAME_VIP_SATURN_DISABLE_JOB_INIT_FAILED_ALARM, + System.getenv(NAME_VIP_SATURN_DISABLE_JOB_INIT_FAILED_ALARM))); + static { loadProperties(); }