java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/tracking/WithEstimatedSpeedCache.java
... ...
@@ -12,6 +12,6 @@ public interface WithEstimatedSpeedCache {
12 12
13 13
void invalidateEstimatedSpeedCache();
14 14
15
- void cacheEstimatedSpeed(SpeedWithBearing estimatedSpeed);
15
+ SpeedWithBearing cacheEstimatedSpeed(SpeedWithBearing estimatedSpeed);
16 16
17 17
}
java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/tracking/impl/AbstractCompactGPSFixImpl.java
... ...
@@ -84,7 +84,7 @@ public abstract class AbstractCompactGPSFixImpl extends AbstractGPSFixImpl {
84 84
}
85 85
86 86
@Override
87
- public void invalidateCache() {
87
+ public synchronized void invalidateCache() {
88 88
whatIsCached &= ~IS_VALIDITY_CACHED;
89 89
}
90 90
... ...
@@ -104,12 +104,13 @@ public abstract class AbstractCompactGPSFixImpl extends AbstractGPSFixImpl {
104 104
}
105 105
106 106
@Override
107
- public void invalidateEstimatedSpeedCache() {
107
+ public synchronized void invalidateEstimatedSpeedCache() {
108 108
whatIsCached &= ~IS_ESTIMATED_SPEED_CACHED;
109 109
}
110 110
111 111
@Override
112
- public void cacheEstimatedSpeed(SpeedWithBearing estimatedSpeed) {
112
+ public synchronized SpeedWithBearing cacheEstimatedSpeed(SpeedWithBearing estimatedSpeed) {
113 113
whatIsCached |= IS_ESTIMATED_SPEED_CACHED;
114
+ return super.cacheEstimatedSpeed(estimatedSpeed);
114 115
}
115 116
}
java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/tracking/impl/AbstractGPSFixImpl.java
... ...
@@ -96,6 +96,7 @@ public abstract class AbstractGPSFixImpl implements GPSFix {
96 96
}
97 97
98 98
@Override
99
- public void cacheEstimatedSpeed(SpeedWithBearing estimatedSpeed) {
99
+ public SpeedWithBearing cacheEstimatedSpeed(SpeedWithBearing estimatedSpeed) {
100
+ return estimatedSpeed;
100 101
}
101 102
}
java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/tracking/impl/PreciseCompactGPSFixImpl.java
... ...
@@ -97,9 +97,9 @@ public class PreciseCompactGPSFixImpl extends AbstractCompactGPSFixImpl {
97 97
}
98 98
99 99
@Override
100
- public void cacheEstimatedSpeed(SpeedWithBearing estimatedSpeed) {
100
+ public SpeedWithBearing cacheEstimatedSpeed(SpeedWithBearing estimatedSpeed) {
101 101
cachedEstimatedSpeedBearingInDegrees = estimatedSpeed.getBearing().getDegrees();
102 102
cachedEstimatedSpeedInKnots = estimatedSpeed.getKnots();
103
- super.cacheEstimatedSpeed(estimatedSpeed);
103
+ return super.cacheEstimatedSpeed(estimatedSpeed);
104 104
}
105 105
}
java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/tracking/impl/PreciseCompactGPSFixMovingImpl.java
... ...
@@ -154,9 +154,9 @@ public class PreciseCompactGPSFixMovingImpl extends AbstractCompactGPSFixMovingI
154 154
}
155 155
156 156
@Override
157
- public void cacheEstimatedSpeed(SpeedWithBearing estimatedSpeed) {
157
+ public SpeedWithBearing cacheEstimatedSpeed(SpeedWithBearing estimatedSpeed) {
158 158
cachedEstimatedSpeedBearingInDegrees = estimatedSpeed.getBearing().getDegrees();
159 159
cachedEstimatedSpeedInKnots = estimatedSpeed.getKnots();
160
- super.cacheEstimatedSpeed(estimatedSpeed);
160
+ return super.cacheEstimatedSpeed(estimatedSpeed);
161 161
}
162 162
}
java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/tracking/impl/VeryCompactGPSFixImpl.java
... ...
@@ -11,6 +11,8 @@ import com.sap.sse.common.Position;
11 11
import com.sap.sse.common.SpeedWithBearing;
12 12
import com.sap.sse.common.TimePoint;
13 13
import com.sap.sse.common.impl.AbstractSpeedWithAbstractBearingImpl;
14
+import com.sap.sse.common.impl.DegreeBearingImpl;
15
+import com.sap.sse.common.impl.KnotSpeedWithBearingImpl;
14 16
15 17
/**
16 18
* A compact representation of a GPS fix which collects all primitive-typed attributes in one object to avoid
... ...
@@ -116,13 +118,17 @@ public class VeryCompactGPSFixImpl extends AbstractCompactGPSFixImpl {
116 118
* uncached.
117 119
*/
118 120
@Override
119
- public void cacheEstimatedSpeed(SpeedWithBearing estimatedSpeed) {
121
+ public synchronized SpeedWithBearing cacheEstimatedSpeed(SpeedWithBearing estimatedSpeed) {
120 122
try {
121 123
cachedEstimatedSpeedInKnotsScaled = CompactPositionHelper.getKnotSpeedScaled(estimatedSpeed);
122 124
cachedEstimatedSpeedBearingInDegreesScaled = CompactPositionHelper.getDegreeBearingScaled(estimatedSpeed.getBearing());
123 125
super.cacheEstimatedSpeed(estimatedSpeed);
126
+ final SpeedWithBearing veryCompactEstimatedSpeed = getCachedEstimatedSpeed();
127
+ return new KnotSpeedWithBearingImpl(veryCompactEstimatedSpeed.getKnots(),
128
+ new DegreeBearingImpl(veryCompactEstimatedSpeed.getBearing().getDegrees()));
124 129
} catch (CompactionNotPossibleException e) {
125 130
logger.log(Level.FINER, "Cannot cache estimated speed "+estimatedSpeed+" in compact fix:", e);
131
+ return estimatedSpeed;
126 132
}
127 133
}
128 134
}
java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/tracking/impl/VeryCompactGPSFixMovingImpl.java
... ...
@@ -11,6 +11,8 @@ import com.sap.sse.common.Position;
11 11
import com.sap.sse.common.SpeedWithBearing;
12 12
import com.sap.sse.common.TimePoint;
13 13
import com.sap.sse.common.impl.AbstractSpeedWithAbstractBearingImpl;
14
+import com.sap.sse.common.impl.DegreeBearingImpl;
15
+import com.sap.sse.common.impl.KnotSpeedWithBearingImpl;
14 16
15 17
/**
16 18
* A memory-conserving representation of a {@link GPSFixMoving} object that produces the fine-grained
... ...
@@ -187,13 +189,17 @@ public class VeryCompactGPSFixMovingImpl extends AbstractCompactGPSFixMovingImpl
187 189
* uncached.
188 190
*/
189 191
@Override
190
- public void cacheEstimatedSpeed(SpeedWithBearing estimatedSpeed) {
192
+ public synchronized SpeedWithBearing cacheEstimatedSpeed(SpeedWithBearing estimatedSpeed) {
191 193
try {
192 194
cachedEstimatedSpeedInKnotsScaled = CompactPositionHelper.getKnotSpeedScaled(estimatedSpeed);
193 195
cachedEstimatedSpeedBearingInDegreesScaled = CompactPositionHelper.getDegreeBearingScaled(estimatedSpeed.getBearing());
194 196
super.cacheEstimatedSpeed(estimatedSpeed);
197
+ final SpeedWithBearing veryCompactEstimatedSpeed = getCachedEstimatedSpeed();
198
+ return new KnotSpeedWithBearingImpl(veryCompactEstimatedSpeed.getKnots(),
199
+ new DegreeBearingImpl(veryCompactEstimatedSpeed.getBearing().getDegrees()));
195 200
} catch (CompactionNotPossibleException e) {
196 201
logger.log(Level.FINER, "Cannot cache estimated speed "+estimatedSpeed+" in compact fix:", e);
202
+ return estimatedSpeed;
197 203
}
198 204
}
199 205
}
java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/common/test/LeaderboardDTODiffingTest.java
... ...
@@ -50,7 +50,7 @@ import com.sap.sse.util.ClonerImpl;
50 50
* <p>
51 51
*
52 52
* The data of a meaningful and non-trivial {@link LeaderboardDTO} is obtained by using an instrumented version of
53
- * <code>SailingServiceImpl.getLeaderboardByName(...)</code> which serializes the leaderboard at the end of the method
53
+ * <code>SailingServiceImpl.getLeaderBoardByNameInternal(...)</code> which serializes the leaderboard at the end of the method
54 54
* to a file used by this test. The leaderboard that this test wants to use is that of the 505 Worlds 2013, obtained for
55 55
* an expanded Race R9 at time 2013-05-03T19:17:09Z after the last competitor tracked has finished the last leg. The
56 56
* total distance traveled in meters has to be expanded for this test to work.
java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/impl/GPSFixTrackImpl.java
... ...
@@ -275,7 +275,8 @@ public abstract class GPSFixTrackImpl<ItemType, FixType extends GPSFix> extends
275 275
}
276 276
277 277
@Override
278
- public void cacheEstimatedSpeed(SpeedWithBearing estimatedSpeed) {
278
+ public SpeedWithBearing cacheEstimatedSpeed(SpeedWithBearing estimatedSpeed) {
279
+ return estimatedSpeed;
279 280
}
280 281
}
281 282
... ...
@@ -633,8 +634,7 @@ public abstract class GPSFixTrackImpl<ItemType, FixType extends GPSFix> extends
633 634
getMillisecondsOverWhichToAverageSpeed() / 2, /* minimumConfidence */ 0.00000001)); // half confidence if half averaging interval apart
634 635
if (estimatedSpeed != null) {
635 636
if (ceil != null && ceil.getTimePoint().equals(at)) {
636
- ceil.cacheEstimatedSpeed(estimatedSpeed.getObject());
637
- result = ceil.getCachedEstimatedSpeed(); // this way, should the fix apply compaction, we will still return consistent (compacted) results
637
+ result = ceil.cacheEstimatedSpeed(estimatedSpeed.getObject()); // this way, should the fix apply compaction, we will still return consistent (compacted) results
638 638
} else {
639 639
result = estimatedSpeed.getObject();
640 640
}
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/SailingServiceImpl.java
... ...
@@ -896,7 +896,7 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet
896 896
// total distance traveled in meters has to be expanded for the test to work.
897 897
final boolean storeLeaderboardForTesting = false;
898 898
if (storeLeaderboardForTesting) {
899
- ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(new File("C:/data/SAP/sailing/workspace/java/com.sap.sailing.domain.test/resources/IncrementalLeaderboardDTO.ser")));
899
+ ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(new File("../com.sap.sailing.domain.test/resources/IncrementalLeaderboardDTO.ser")));
900 900
oos.writeObject(leaderboardDTO);
901 901
oos.close();
902 902
}