mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-03 10:53:49 +00:00
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:
1 parent
7f704e7af0
commit
f4639fa382
1 file changed
+2
-2
+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
|
||||
|
||||
Reference in new issue
Block a user