mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-25 06:58:39 +00:00
invalidate leaderboard cache also upon RegattaLogEvents that are marked accordingly
Change-Id: Ib01741dd8a8854ce1f510e87ce5b30ee5bbcc937
This commit is contained in:
-1
@@ -23,7 +23,6 @@ public class RaceLogORCUseImpliedWindFromOtherRaceEventImpl extends AbstractLogE
|
||||
super(createdAt, logicalTimePoint, author, pId);
|
||||
this.raceLogEventData = new RaceLogEventDataImpl(/* involvedBoats */ null, passId);
|
||||
this.otherRace = otherRace;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+4
-2
@@ -1,8 +1,10 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEvent;
|
||||
|
||||
/**
|
||||
* Marker interface that all classes implementing {@link RaceLogEvent} should
|
||||
* also implement, if the addition of that event should invalidate leaderboard cache.
|
||||
* Marker interface that all classes implementing {@link RaceLogEvent} or {@link RegattaLogEvent} should also implement,
|
||||
* if the addition of that event should invalidate leaderboard cache.
|
||||
*
|
||||
* @author Simon Marcel Pamies
|
||||
*/
|
||||
|
||||
+11
-1
@@ -25,8 +25,10 @@ import java.util.function.Consumer;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.InvalidatesLeaderboardCache;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEvent;
|
||||
import com.sap.sailing.domain.base.Boat;
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
@@ -1181,7 +1183,15 @@ public abstract class AbstractLeaderboardWithCache implements Leaderboard {
|
||||
return getCompetitorsFromBestToWorst(timePoint).indexOf(competitor) + 1;
|
||||
}
|
||||
|
||||
public void raceLogEventAdded(RaceColumn raceColumn, RaceLogIdentifier raceLogIdentifier, RaceLogEvent event) {
|
||||
protected void regattaLogEventAdded(RegattaLogEvent event) {
|
||||
invalidateCacheIfEventSaysSo(event);
|
||||
}
|
||||
|
||||
protected void raceLogEventAdded(RaceColumn raceColumn, RaceLogIdentifier raceLogIdentifier, RaceLogEvent event) {
|
||||
invalidateCacheIfEventSaysSo(event);
|
||||
}
|
||||
|
||||
private void invalidateCacheIfEventSaysSo(AbstractLogEvent<?> event) {
|
||||
if (event instanceof InvalidatesLeaderboardCache) {
|
||||
// make sure to invalidate the cache as this event indicates that
|
||||
// it changes values the cache could still hold
|
||||
|
||||
+1
@@ -932,6 +932,7 @@ public abstract class AbstractSimpleLeaderboardImpl extends AbstractLeaderboardW
|
||||
@Override
|
||||
public void regattaLogEventAdded(RegattaLogEvent event) {
|
||||
getRaceColumnListeners().notifyListenersAboutRegattaLogEventAdded(event);
|
||||
super.regattaLogEventAdded(event);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
||||
Reference in New Issue
Block a user