fix possible deadlock problem: when asking for the tracked race outside the synchronized block,

it may still be null; however, it may get filled before the synchronized block gets entered.
Therefore, the get needs to be inside the synchronized block.
This commit is contained in:
Axel Uhl committed 2011-06-18 23:51:47 +02:00
1 parent 7f704e7af0
commit f4639fa382
1 file changed
+2 -2
@@ -83,9 +83,9 @@ public class TrackedEventImpl implements TrackedEvent {
@Override
public TrackedRace getTrackedRace(RaceDefinition race) {
TrackedRace result = trackedRaces.get(race);
boolean interrupted = false;
synchronized (trackedRaces) {
TrackedRace result = trackedRaces.get(race);
while (!interrupted && result == null) {
try {
trackedRaces.wait();
@@ -94,8 +94,8 @@ public class TrackedEventImpl implements TrackedEvent {
interrupted = true;
}
}
return result;
}
return result;
}
@Override