mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-14 22:43:57 +00:00
one more edition of the failing test case for bug2626
This commit is contained in:
1 parent
bd8616aab8
commit
c5e23bce8d
2 files changed
+10
-6
No files matched your search
@@ -56,7 +56,6 @@ import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.Util.Pair;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
import com.sap.sse.concurrent.LockUtil;
|
||||
|
||||
public class TrackTest {
|
||||
private DynamicGPSFixTrack<Boat, GPSFixMoving> track;
|
||||
@@ -279,7 +278,6 @@ public class TrackTest {
|
||||
|
||||
@Override
|
||||
public void gpsFixReceived(GPSFixMoving fix, Object item, boolean firstFixInTrack) {
|
||||
LockUtil.lockForWrite(getLock());
|
||||
try {
|
||||
// trigger the barrier after having acquired the cache write lock; this is what the
|
||||
// super.gpsFixReceived(...) method will also do (reentrantly), but this way we can
|
||||
@@ -289,8 +287,6 @@ public class TrackTest {
|
||||
gpsFixReceivedDone.await();
|
||||
} catch (InterruptedException | BrokenBarrierException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
LockUtil.unlockAfterWrite(getLock());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+10
-2
@@ -180,8 +180,16 @@ public class MaxSpeedCache<ItemType, FixType extends GPSFix> implements GPSTrack
|
||||
if (!to.before(from)) {
|
||||
result = cacheLookup(from, to);
|
||||
if (result == null) {
|
||||
result = computeMaxSpeed(from, to);
|
||||
cache(from, to, result);
|
||||
// LockUtil.lockForWrite(lock);
|
||||
// try {
|
||||
// need to run both, the re-calculation as well as the caching, under the write lock because otherwise
|
||||
// an invocation of gpsFixReceived(...) may cut in between, obtain the write lock and perform invalidations
|
||||
// that would have needed to invalidate the value recalculated.
|
||||
result = computeMaxSpeed(from, to);
|
||||
cache(from, to, result);
|
||||
// } finally {
|
||||
// LockUtil.unlockAfterWrite(lock);
|
||||
// }
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
Reference in new issue
Block a user