java/com.sap.sailing.domain/src/com/sap/sailing/domain/markpassingcalculation/MarkPassingCalculator.java
... ...
@@ -11,7 +11,6 @@ import java.util.Map;
11 11
import java.util.Map.Entry;
12 12
import java.util.Set;
13 13
import java.util.concurrent.Callable;
14
-import java.util.concurrent.CountDownLatch;
15 14
import java.util.concurrent.ExecutorService;
16 15
import java.util.concurrent.LinkedBlockingQueue;
17 16
import java.util.logging.Level;
... ...
@@ -461,8 +460,6 @@ public class MarkPassingCalculator {
461 460
fixesForCompetitor.addAll(competitorEntry.getValue());
462 461
}
463 462
if (!newMarkFixes.isEmpty()) {
464
- // FIXME bug 2745 use new mark fixes to invalidate chooser's mark position and mutual mark/waypoint
465
- // distance cache
466 463
for (Entry<Competitor, List<GPSFixMoving>> fixesAffectedByNewMarkFixes : finder
467 464
.calculateFixesAffectedByNewMarkFixes(newMarkFixes).entrySet()) {
468 465
Collection<GPSFixMoving> fixes = combinedCompetitorFixesFinderConsidersAffected
... ...
@@ -593,36 +590,26 @@ public class MarkPassingCalculator {
593 590
suspended = false;
594 591
} else {
595 592
suspended = false;
596
- final CountDownLatch latchForRunningListenRun = new CountDownLatch(1);
597
- enqueueUpdate(new StorePositionUpdateStrategy() {
598
- @Override
599
- public void storePositionUpdate(Map<Competitor, List<GPSFixMoving>> competitorFixes,
600
- Map<Competitor, List<GPSFixMoving>> competitorFixesThatReplacedExistingOnes,
601
- Map<Mark, List<GPSFix>> markFixes, List<Waypoint> addedWaypoints,
602
- List<Waypoint> removedWaypoints, IntHolder smallestChangedWaypointIndex,
603
- List<Triple<Competitor, Integer, TimePoint>> fixedMarkPassings,
604
- List<Pair<Competitor, Integer>> removedMarkPassings,
605
- List<Pair<Competitor, Integer>> suppressedMarkPassings,
606
- List<Competitor> unSuppressedMarkPassings, CandidateFinder candidateFinder,
607
- CandidateChooser candidateChooser) {
608
- latchForRunningListenRun.countDown();
609
- assert latchForRunningListenRun.getCount() == 0;
610
- }
611
- });
612 593
if (markPassingRaceFingerprintRegistry != null) {
613
- new Thread(()->{
614
- try {
615
- latchForRunningListenRun.await();
616
- final Map<Competitor, Map<Waypoint, MarkPassing>> markPassings = race.getMarkPassings(/* waitForLatestUpdates */ true);
617
- markPassingRaceFingerprintRegistry.storeMarkPassings(race.getRaceIdentifier(),
618
- MarkPassingRaceFingerprintFactory.INSTANCE.createFingerprint(race),
619
- markPassings, race.getRace().getCourse());
620
- } catch (InterruptedException e) {
621
- logger.log(Level.SEVERE, "Exception while waiting for Listen.run() to start processing in MarkPassingCalculator for "+
622
- race.getName(), e);
594
+ enqueueUpdate(new StorePositionUpdateStrategy() {
595
+ @Override
596
+ public void storePositionUpdate(Map<Competitor, List<GPSFixMoving>> competitorFixes,
597
+ Map<Competitor, List<GPSFixMoving>> competitorFixesThatReplacedExistingOnes,
598
+ Map<Mark, List<GPSFix>> markFixes, List<Waypoint> addedWaypoints,
599
+ List<Waypoint> removedWaypoints, IntHolder smallestChangedWaypointIndex,
600
+ List<Triple<Competitor, Integer, TimePoint>> fixedMarkPassings,
601
+ List<Pair<Competitor, Integer>> removedMarkPassings,
602
+ List<Pair<Competitor, Integer>> suppressedMarkPassings,
603
+ List<Competitor> unSuppressedMarkPassings, CandidateFinder candidateFinder,
604
+ CandidateChooser candidateChooser) {
605
+ executor.submit(()->{
606
+ final Map<Competitor, Map<Waypoint, MarkPassing>> markPassings = race.getMarkPassings(/* waitForLatestUpdates */ true);
607
+ markPassingRaceFingerprintRegistry.storeMarkPassings(race.getRaceIdentifier(),
608
+ MarkPassingRaceFingerprintFactory.INSTANCE.createFingerprint(race),
609
+ markPassings, race.getRace().getCourse());
610
+ });
623 611
}
624
- }, "Waiting for mark passings for "+race.getName()+" after having resumed to store the results in registry")
625
- .start();
612
+ });
626 613
}
627 614
}
628 615
}