mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 13:20:57 +00:00
stopping the tracker after receiving the stopped() callback through TTCM; Receivers are stopped non-preemtively
This commit is contained in:
1 parent
43d278ae19
commit
75b42afcff
1 file changed
+19
-26
+19
-26
@@ -550,6 +550,25 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl implements
|
||||
logger.info("stopped TracTrac tracking for "+getRaces());
|
||||
lastStatus = new TrackedRaceStatusImpl(TrackedRaceStatusEnum.FINISHED, 1.0);
|
||||
updateStatusOfTrackedRaces();
|
||||
for (final RaceDefinition race : getRaces()) {
|
||||
// Ask RacingEventService to cleanly stop and unregister this tracker
|
||||
// if the race has all data loaded. Doing this asynchronously because
|
||||
// stopping can take longer and if you're loading many races in parallel
|
||||
// this can slow down loading extremely because this call-back seems to be
|
||||
// called by TTCM synchronously.
|
||||
Thread raceStopper = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
trackedRegattaRegistry.stopTracking(regatta, race);
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.SEVERE, "Error trying to stop tracker for race " + race.getName()
|
||||
+ " in regatta " + getRegatta().getName(), e);
|
||||
}
|
||||
}
|
||||
});
|
||||
raceStopper.start();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateStatusOfTrackedRaces() {
|
||||
@@ -580,32 +599,6 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl implements
|
||||
if (isLiveTracking) {
|
||||
lastStatus = new TrackedRaceStatusImpl(TrackedRaceStatusEnum.TRACKING, 1);
|
||||
updateStatusOfTrackedRaces();
|
||||
} else {
|
||||
// ask RacingEventService to cleanly stop and unregister this tracker
|
||||
// if the race has all data loaded. Doing this asynchronously because
|
||||
// stopping can take longer and if you're loading many races in parallel
|
||||
// this can slow down loading extremely because this call-back seems to be
|
||||
// called by TTCM synchronously.
|
||||
for (final RaceDefinition race : getRaces()) {
|
||||
DynamicTrackedRace trackedRace = getTrackedRegatta().getExistingTrackedRace(race);
|
||||
final Regatta regatta = getRegatta();
|
||||
if (trackedRace.getStatus().getLoadingProgress() == 1.0) {
|
||||
Thread raceStopper = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
trackedRegattaRegistry.stopTracking(regatta, race);
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.SEVERE, "Error trying to stop tracker for race "+race.getName()+
|
||||
" in regatta "+getRegatta().getName(), e);
|
||||
}
|
||||
}
|
||||
});
|
||||
raceStopper.start();
|
||||
} else {
|
||||
logger.log(Level.SEVERE, "Not stopping race "+race.getName()+" because it has not all data loaded! Progress: " + trackedRace.getStatus().getLoadingProgress());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user