Skip to content

Commit

Permalink
Fix ConcurrentModificationException when we traverse registeredTasks #…
Browse files Browse the repository at this point in the history
…664 (#665)

* [bugfix] ConcurrentModificationException when we traverse registeredTasks #664

* remove unused import
  • Loading branch information
oliverhu authored Apr 28, 2022
1 parent 63fe90f commit 6e0985b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ ext.deps = [

allprojects {
group = "com.linkedin.tony"
project.version = "0.5.1"
project.version = "0.5.2"
}

task sourcesJar(type: Jar) {
Expand Down
5 changes: 2 additions & 3 deletions tony-core/src/main/java/com/linkedin/tony/TonySession.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -67,7 +66,7 @@ public class TonySession {
// go straight to the cleaning phase.
private boolean trainingFinished = false;

private Set<String> registeredTasks = new HashSet<>();
private Set<String> registeredTasks = ConcurrentHashMap.newKeySet();

private int numExpectedTasks = 0;

Expand Down Expand Up @@ -677,7 +676,7 @@ public void addRegisteredTask(String taskId) {
}

public void resetRegisteredTasks() {
registeredTasks = new HashSet<>();
registeredTasks = ConcurrentHashMap.newKeySet();
}

public int getNumRegisteredTasks() {
Expand Down

0 comments on commit 6e0985b

Please sign in to comment.