Skip to content

Commit

Permalink
Comment fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali Reza Zamani Zadeh Najari committed Feb 12, 2020
1 parent de0f8fb commit 1d5a284
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions helix-core/src/main/java/org/apache/helix/task/TaskUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -1040,8 +1040,6 @@ public static void purgeExpiredJobs(String workflow, WorkflowConfig workflowConf
/**
* The function that loops through the all existing workflow contexts and removes IdealState and
* workflow context of the workflow whose workflow config does not exist.
* Try-catch has been used to avoid concurrent modification exception while doing deep copy. Since
* Map.keySet() can produce concurrent modification exception.
* @param dataProvider
* @param manager
*/
Expand All @@ -1050,11 +1048,17 @@ public static void workflowGarbageCollection(final WorkflowControllerDataProvide
// Garbage collections for conditions where workflow context exists but config is missing.

Set<String> existingWorkflowContexts;
/*
* Here try-catch is used to avoid concurrent modification exception while doing deep copy.
* Map.keySet() can produce concurrent modification exception.
* Reason: If the map is modified while an iteration over the set is in progress, concurrent
* modification exception will be thrown.
*/
try {
existingWorkflowContexts = new HashSet<>(dataProvider.getContexts().keySet());
} catch (Exception e) {
LOG.warn(
"Exception occurred while creating a list of all existing contexts with missing config!",
"Exception occurred while creating a list of all workflow context names with missing workflow config!",
e);
return;
}
Expand Down

0 comments on commit 1d5a284

Please sign in to comment.