b455c9a73036b643e2704565302fce33c7a35824
java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/DynamicTrackedRace.java
| ... | ... | @@ -132,8 +132,6 @@ public interface DynamicTrackedRace extends TrackedRace { |
| 132 | 132 | */ |
| 133 | 133 | void updateMarkPassingsAfterRaceLogChanges(); |
| 134 | 134 | |
| 135 | - void updateManeuvers(Competitor competitor, Iterable<Maneuver> maneuvers); |
|
| 136 | - |
|
| 137 | 135 | /** |
| 138 | 136 | * Sets the start time as received from the tracking infrastructure. This isn't necessarily |
| 139 | 137 | * what {@link #getStart()} will deliver which assumes that the time announced here may be |
java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/impl/DynamicTrackedRaceImpl.java
| ... | ... | @@ -58,7 +58,6 @@ import com.sap.sailing.domain.tracking.DynamicTrackedRace; |
| 58 | 58 | import com.sap.sailing.domain.tracking.DynamicTrackedRegatta; |
| 59 | 59 | import com.sap.sailing.domain.tracking.GPSFixTrack; |
| 60 | 60 | import com.sap.sailing.domain.tracking.GPSTrackListener; |
| 61 | -import com.sap.sailing.domain.tracking.Maneuver; |
|
| 62 | 61 | import com.sap.sailing.domain.tracking.MarkPassing; |
| 63 | 62 | import com.sap.sailing.domain.tracking.RaceAbortedListener; |
| 64 | 63 | import com.sap.sailing.domain.tracking.RaceChangeListener; |
| ... | ... | @@ -938,123 +937,6 @@ DynamicTrackedRace, GPSTrackListener<Competitor, GPSFixMoving> { |
| 938 | 937 | } |
| 939 | 938 | } |
| 940 | 939 | |
| 941 | - |
|
| 942 | - @Override |
|
| 943 | - public void updateManeuvers(Competitor competitor, Iterable<Maneuver> maneuvers) { |
|
| 944 | - final CompetitorResult resultFromRaceLog = competitorResultsFromRaceLog.get(competitor); |
|
| 945 | - updateManeuversConsideringFinishingTimesFromRaceLog(competitor, maneuvers, resultFromRaceLog); |
|
| 946 | - } |
|
| 947 | - |
|
| 948 | - |
|
| 949 | - |
|
| 950 | - |
|
| 951 | - |
|
| 952 | - |
|
| 953 | - private void updateManeuversConsideringFinishingTimesFromRaceLog(Competitor competitor, |
|
| 954 | - Iterable<Maneuver> maneuvers, CompetitorResult resultFromRaceLog) { |
|
| 955 | - LockUtil.lockForRead(getSerializationLock()); // keep serializer from reading the mark passings collections |
|
| 956 | - try { |
|
| 957 | -// List<Maneuver> oldManeuvers = new ArrayList<Maneuver>(); |
|
| 958 | -// TimePoint finishTime = resultFromRaceLog.getFinishingTime(); |
|
| 959 | -// MarkPassing oldStartMarkPassing = null; |
|
| 960 | -// boolean requiresStartTimeUpdate = true; |
|
| 961 | -// final Iterable<Maneuver> maneuversForCompetitor = getManeuvers(competitor, false); |
|
| 962 | -// lockForRead(maneuversForCompetitor); |
|
| 963 | -// try { |
|
| 964 | -// for (Maneuver oldMarkPassing : maneuversForCompetitor) { |
|
| 965 | -// if (oldStartMarkPassing == null) { |
|
| 966 | -// oldStartMarkPassing = oldMarkPassing; |
|
| 967 | -// } |
|
| 968 | -// oldMarkPassings.put(oldMarkPassing.getWaypoint(), oldMarkPassing); |
|
| 969 | -// } |
|
| 970 | -// } finally { |
|
| 971 | -// unlockAfterRead(maneuversForCompetitor); |
|
| 972 | -// } |
|
| 973 | -// final NamedReentrantReadWriteLock markPassingsLock = getMarkPassingsLock(maneuversForCompetitor); |
|
| 974 | -// TimePoint timePointOfLatestEvent = new MillisecondsTimePoint(0); |
|
| 975 | -// // Make sure that clearMarkPassings and the re-adding of the mark passings are non-interruptible by readers. |
|
| 976 | -// // Note that the write lock for the mark passings in order per waypoint is obtained inside |
|
| 977 | -// // clearMarkPassings(...) as well as inside the subsequent for-loop. It is important to always first obtain the mark passings lock |
|
| 978 | -// // for the competitor mark passings before obtaining the lock for the mark passings in order for the waypoint to avoid |
|
| 979 | -// // deadlocks. |
|
| 980 | -// getRace().getCourse().lockForRead(); |
|
| 981 | -// LockUtil.lockForWrite(markPassingsLock); |
|
| 982 | -// try { |
|
| 983 | -// clearMarkPassings(competitor); |
|
| 984 | -// for (MarkPassing markPassing : markPassings) { |
|
| 985 | -// // Now since this caller of this update may not have held the course lock, mark passings |
|
| 986 | -// // may already be obsolete and for waypoints that no longer exist. Check: |
|
| 987 | -// if (getRace().getCourse().getIndexOfWaypoint(markPassing.getWaypoint()) >= 0) { |
|
| 988 | -// // try to find corresponding old start mark passing |
|
| 989 | -// if (oldStartMarkPassing != null |
|
| 990 | -// && markPassing.getWaypoint().equals(oldStartMarkPassing.getWaypoint())) { |
|
| 991 | -// if (markPassing.getTimePoint() != null && oldStartMarkPassing.getTimePoint() != null |
|
| 992 | -// && markPassing.getTimePoint().equals(oldStartMarkPassing.getTimePoint())) { |
|
| 993 | -// requiresStartTimeUpdate = false; |
|
| 994 | -// } |
|
| 995 | -// } |
|
| 996 | -// if (!Util.contains(getRace().getCourse().getWaypoints(), markPassing.getWaypoint())) { |
|
| 997 | -// StringBuilder courseWaypointsWithID = new StringBuilder(); |
|
| 998 | -// boolean first = true; |
|
| 999 | -// for (Waypoint courseWaypoint : getRace().getCourse().getWaypoints()) { |
|
| 1000 | -// if (first) { |
|
| 1001 | -// first = false; |
|
| 1002 | -// } else { |
|
| 1003 | -// courseWaypointsWithID.append(" -> "); |
|
| 1004 | -// } |
|
| 1005 | -// courseWaypointsWithID.append(courseWaypoint.toString()); |
|
| 1006 | -// courseWaypointsWithID.append(" (ID="); |
|
| 1007 | -// courseWaypointsWithID.append(courseWaypoint.getId()); |
|
| 1008 | -// courseWaypointsWithID.append(")"); |
|
| 1009 | -// } |
|
| 1010 | -// logger.severe("Received mark passing " + markPassing + " for race " + getRace() |
|
| 1011 | -// + " for waypoint ID" + markPassing.getWaypoint().getId() |
|
| 1012 | -// + " but the waypoint does not exist in course " + courseWaypointsWithID); |
|
| 1013 | -// } else { |
|
| 1014 | -// markPassingsForCompetitor.add(markPassing); |
|
| 1015 | -// } |
|
| 1016 | -// Collection<MarkPassing> markPassingsInOrderForWaypoint = getOrCreateMarkPassingsInOrderAsNavigableSet(markPassing |
|
| 1017 | -// .getWaypoint()); |
|
| 1018 | -// final NamedReentrantReadWriteLock markPassingsLock2 = getMarkPassingsLock(markPassingsInOrderForWaypoint); |
|
| 1019 | -// LockUtil.lockForWrite(markPassingsLock2); |
|
| 1020 | -// try { |
|
| 1021 | -// // The mark passings of competitor have been removed by the call to |
|
| 1022 | -// // clearMarkPassings(competitor) above |
|
| 1023 | -// // from both, the collection that holds the mark passings by waypoint and the one that holds the |
|
| 1024 | -// // mark passings per competitor; so we can simply add here: |
|
| 1025 | -// markPassingsInOrderForWaypoint.add(markPassing); |
|
| 1026 | -// } finally { |
|
| 1027 | -// LockUtil.unlockAfterWrite(markPassingsLock2); |
|
| 1028 | -// } |
|
| 1029 | -// if (markPassing.getTimePoint().compareTo(timePointOfLatestEvent) > 0) { |
|
| 1030 | -// timePointOfLatestEvent = markPassing.getTimePoint(); |
|
| 1031 | -// } |
|
| 1032 | -// } else { |
|
| 1033 | -// logger.warning("Received mark passing "+markPassing+ |
|
| 1034 | -// " for non-existing waypoint "+markPassing.getWaypoint()+ |
|
| 1035 | -// " in race "+getRace().getName()+". Ignoring."); |
|
| 1036 | -// } |
|
| 1037 | -// } |
|
| 1038 | -// } finally { |
|
| 1039 | -// LockUtil.unlockAfterWrite(maneuversLock); |
|
| 1040 | -// getRace().getCourse().unlockAfterRead(); |
|
| 1041 | -// } |
|
| 1042 | -// updated(timePointOfLatestEvent); |
|
| 1043 | -// triggerManeuverCacheRecalculation(competitor); |
|
| 1044 | -// // update the race times like start, end and the leg times |
|
| 1045 | -// if (requiresStartTimeUpdate) { |
|
| 1046 | -// invalidateStartTime(); |
|
| 1047 | -// } |
|
| 1048 | -// invalidateMarkPassingTimes(); |
|
| 1049 | -// invalidateEndTime(); |
|
| 1050 | -// // notify *after* all mark passings have been re-established; should avoid flicker |
|
| 1051 | -// notifyListeners(competitor, oldMarkPassings, markPassings); |
|
| 1052 | - } finally { |
|
| 1053 | - LockUtil.unlockAfterRead(getSerializationLock()); |
|
| 1054 | - } |
|
| 1055 | - |
|
| 1056 | - } |
|
| 1057 | - |
|
| 1058 | 940 | /** |
| 1059 | 941 | * The {@link CompetitorResults} from the race log as cached in {@link #competitorResultsFromRaceLog} may optionally |
| 1060 | 942 | * set a finishing time for competitors. Also, depending on how the race log has been modified (e.g., a new pass |