Skip to content

Commit

Permalink
#483 add switch for disable job init failed alarm
Browse files Browse the repository at this point in the history
  • Loading branch information
kfchu committed Sep 26, 2018
1 parent c3c619f commit 1081a25
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 1081a25

Please sign in to comment.