Protect joins map with mutex - fixes issue #652

This commit is contained in:
Tom Morris 2013-03-03 09:36:43 -05:00
parent 0dfd7d7112
commit eba03fc69e

View File

@ -99,13 +99,16 @@ public class InterProjectModel {
computeJoin(join); computeJoin(join);
synchronized (_joins) {
_joins.put(key, join); _joins.put(key, join);
} }
}
return _joins.get(key); return _joins.get(key);
} }
public void flushJoinsInvolvingProject(long projectID) { public void flushJoinsInvolvingProject(long projectID) {
synchronized (_joins) {
for (Entry<String, ProjectJoin> entry : _joins.entrySet()) { for (Entry<String, ProjectJoin> entry : _joins.entrySet()) {
ProjectJoin join = entry.getValue(); ProjectJoin join = entry.getValue();
if (join.fromProjectID == projectID || join.toProjectID == projectID) { if (join.fromProjectID == projectID || join.toProjectID == projectID) {
@ -113,8 +116,10 @@ public class InterProjectModel {
} }
} }
} }
}
public void flushJoinsInvolvingProjectColumn(long projectID, String columnName) { public void flushJoinsInvolvingProjectColumn(long projectID, String columnName) {
synchronized (_joins) {
for (Entry<String, ProjectJoin> entry : _joins.entrySet()) { for (Entry<String, ProjectJoin> entry : _joins.entrySet()) {
ProjectJoin join = entry.getValue(); ProjectJoin join = entry.getValue();
if (join.fromProjectID == projectID && join.fromProjectColumnName.equals(columnName) || if (join.fromProjectID == projectID && join.fromProjectColumnName.equals(columnName) ||
@ -123,6 +128,7 @@ public class InterProjectModel {
} }
} }
} }
}
protected void computeJoin(ProjectJoin join) { protected void computeJoin(ProjectJoin join) {
if (join.fromProjectID < 0 || join.toProjectID < 0) { if (join.fromProjectID < 0 || join.toProjectID < 0) {