Skip to content

Commit

Permalink
null check refactor (Signed-off-by: Jeffrey Liu [email protected])
Browse files Browse the repository at this point in the history
Signed-off-by: CoderJeffrey <[email protected]>
  • Loading branch information
CoderJeffrey committed Jul 27, 2023
1 parent 4635d6c commit a2591cb
Showing 1 changed file with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,23 +201,28 @@ public SearchBpActionsAlarmMonitor createAlarmMonitor(Path persistenceBasePath)
public void initialize() {
LOG.info("Initializing alarms with dummy path");
// initialize shard level alarm for resounce unit that suggests to increase jvm threshold
if (searchBackPressureShardHeapIncreaseAlarm == null) {
searchBackPressureShardHeapIncreaseAlarm = createAlarmMonitor(SEARCHBP_DATA_FILE_PATH);
}
searchBackPressureShardHeapIncreaseAlarm =
initializeAlarmMonitor(searchBackPressureShardHeapIncreaseAlarm);

// initialize shard level alarm for resounce unit that suggests to decrease jvm threshold
if (searchBackPressureShardHeapDecreaseAlarm == null) {
searchBackPressureShardHeapDecreaseAlarm = createAlarmMonitor(SEARCHBP_DATA_FILE_PATH);
}
searchBackPressureShardHeapDecreaseAlarm =
initializeAlarmMonitor(searchBackPressureShardHeapDecreaseAlarm);

// initialize task level alarm for resounce unit that suggests to increase jvm threshold
if (searchBackPressureTaskHeapIncreaseAlarm == null) {
searchBackPressureTaskHeapIncreaseAlarm = createAlarmMonitor(SEARCHBP_DATA_FILE_PATH);
}
searchBackPressureTaskHeapIncreaseAlarm =
initializeAlarmMonitor(searchBackPressureTaskHeapIncreaseAlarm);

// initialize task level alarm for resounce unit that suggests to decrease jvm threhsold
if (searchBackPressureTaskHeapDecreaseAlarm == null) {
searchBackPressureTaskHeapDecreaseAlarm = createAlarmMonitor(SEARCHBP_DATA_FILE_PATH);
searchBackPressureTaskHeapDecreaseAlarm =
initializeAlarmMonitor(searchBackPressureTaskHeapDecreaseAlarm);
}

private SearchBpActionsAlarmMonitor initializeAlarmMonitor(
SearchBpActionsAlarmMonitor alarmMonitor) {
if (alarmMonitor == null) {
return createAlarmMonitor(SEARCHBP_DATA_FILE_PATH);
} else {
return alarmMonitor;
}
}

Expand All @@ -239,9 +244,6 @@ public List<Action> evaluate() {
initialize();

recordIssues();
// TODO: Search Task and Shard Alarm Should be seperated
// checkShardAlamr() and but first 2 ifs inside?
// checkTaskAlarms() and but last 2 ifs inside?

checkShardAlarms(actions);
checkTaskAlarms(actions);
Expand Down

0 comments on commit a2591cb

Please sign in to comment.