diff --git a/main/src/com/google/refine/InterProjectModel.java b/main/src/com/google/refine/InterProjectModel.java index 8212157b4..7a2da820b 100644 --- a/main/src/com/google/refine/InterProjectModel.java +++ b/main/src/com/google/refine/InterProjectModel.java @@ -99,27 +99,33 @@ public class InterProjectModel { computeJoin(join); - _joins.put(key, join); + synchronized (_joins) { + _joins.put(key, join); + } } return _joins.get(key); } public void flushJoinsInvolvingProject(long projectID) { - for (Entry entry : _joins.entrySet()) { - ProjectJoin join = entry.getValue(); - if (join.fromProjectID == projectID || join.toProjectID == projectID) { - _joins.remove(entry.getKey()); + synchronized (_joins) { + for (Entry entry : _joins.entrySet()) { + ProjectJoin join = entry.getValue(); + if (join.fromProjectID == projectID || join.toProjectID == projectID) { + _joins.remove(entry.getKey()); + } } } } public void flushJoinsInvolvingProjectColumn(long projectID, String columnName) { - for (Entry entry : _joins.entrySet()) { - ProjectJoin join = entry.getValue(); - if (join.fromProjectID == projectID && join.fromProjectColumnName.equals(columnName) || - join.toProjectID == projectID && join.toProjectColumnName.equals(columnName)) { - _joins.remove(entry.getKey()); + synchronized (_joins) { + for (Entry entry : _joins.entrySet()) { + ProjectJoin join = entry.getValue(); + if (join.fromProjectID == projectID && join.fromProjectColumnName.equals(columnName) || + join.toProjectID == projectID && join.toProjectColumnName.equals(columnName)) { + _joins.remove(entry.getKey()); + } } } }