Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
924060929 committed Oct 14, 2024
1 parent 96d9a0b commit 5a97795
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,25 @@
import java.util.Map;

public class ChildrenRuntimeTasks<Id, C extends AbstractRuntimeTask<?, ?>> {
private final Map<Id, C> childrenTasks = Maps.newConcurrentMap();
// LinkedHashMap: make sure the key set order is same as the input map
// so that we can the runtime filter merge backend first
private final Map<Id, C> childrenTasks = Maps.newLinkedHashMap();

public ChildrenRuntimeTasks(Map<Id, C> childrenTasks) {
this.childrenTasks.putAll(childrenTasks);
synchronized (this) {
this.childrenTasks.putAll(childrenTasks);
}
}

public C get(Id id) {
public synchronized C get(Id id) {
return childrenTasks.get(id);
}

public List<C> allTasks() {
public synchronized List<C> allTasks() {
return Utils.fastToImmutableList(childrenTasks.values());
}

public Map<Id, C> allTaskMap() {
public synchronized Map<Id, C> allTaskMap() {
return ImmutableMap.copyOf(childrenTasks);
}
}

0 comments on commit 5a97795

Please sign in to comment.