mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-14 08:11:00 +00:00
Added try/finally to ensure that unlock is correctly called if an
exception is thrown by TrackedRace.setStatusAndProgress
This commit is contained in:
1 parent
72463bc793
commit
0ab64a06e3
1 file changed
+10
-7
+10
-7
@@ -308,15 +308,18 @@ public class FixLoaderAndTracker implements TrackingDataLoader {
|
||||
updateCallback.run();
|
||||
}
|
||||
} finally {
|
||||
synchronized (FixLoaderAndTracker.this) {
|
||||
int currentActiveLoaders = activeLoaders.decrementAndGet();
|
||||
FixLoaderAndTracker.this.notifyAll();
|
||||
if (currentActiveLoaders == 0) {
|
||||
setStatusAndProgress(stopRequested.get() ? TrackedRaceStatusEnum.FINISHED
|
||||
: TrackedRaceStatusEnum.TRACKING, 1.0);
|
||||
try {
|
||||
synchronized (FixLoaderAndTracker.this) {
|
||||
int currentActiveLoaders = activeLoaders.decrementAndGet();
|
||||
FixLoaderAndTracker.this.notifyAll();
|
||||
if (currentActiveLoaders == 0) {
|
||||
setStatusAndProgress(stopRequested.get() ? TrackedRaceStatusEnum.FINISHED
|
||||
: TrackedRaceStatusEnum.TRACKING, 1.0);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
trackedRace.unlockAfterSerializationRead();
|
||||
}
|
||||
trackedRace.unlockAfterSerializationRead();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user