fixing the fix of the previous commit which still caused and endless recursion

This commit is contained in:
Axel Uhl committed 2014-01-21 21:25:00 +01:00
1 parent 5e97ea3b0e
commit a5083691a2
2 files changed
+10 -8

No files matched your search

@@ -91,12 +91,6 @@ public abstract class TrackedRaceWithWindEssentials implements TrackedRace {
result = createWindTrack(windSource, result = createWindTrack(windSource,
delayForWindEstimationCacheInvalidation == -1 ? getMillisecondsOverWhichToAverageWind() / 2 delayForWindEstimationCacheInvalidation == -1 ? getMillisecondsOverWhichToAverageWind() / 2
: delayForWindEstimationCacheInvalidation); : delayForWindEstimationCacheInvalidation);
LockUtil.lockForRead(getSerializationLock());
try {
windTracks.put(windSource, result);
} finally {
LockUtil.unlockAfterRead(getSerializationLock());
}
} }
} }
} }
@@ -116,6 +110,14 @@ public abstract class TrackedRaceWithWindEssentials implements TrackedRace {
protected WindTrack createWindTrack(WindSource windSource, long delayForWindEstimationCacheInvalidation) { protected WindTrack createWindTrack(WindSource windSource, long delayForWindEstimationCacheInvalidation) {
WindTrack result = windStore.getWindTrack(trackedRegatta.getRegatta().getName(), this, windSource, millisecondsOverWhichToAverageWind, WindTrack result = windStore.getWindTrack(trackedRegatta.getRegatta().getName(), this, windSource, millisecondsOverWhichToAverageWind,
delayForWindEstimationCacheInvalidation); delayForWindEstimationCacheInvalidation);
synchronized (windTracks) {
LockUtil.lockForRead(getSerializationLock());
try {
windTracks.put(windSource, result);
} finally {
LockUtil.unlockAfterRead(getSerializationLock());
}
}
return result; return result;
} }
@@ -623,8 +623,8 @@ DynamicTrackedRace, GPSTrackListener<Competitor, GPSFixMoving> {
* wind fixes that may have been loaded from the wind store for the new track. * wind fixes that may have been loaded from the wind store for the new track.
*/ */
@Override @Override
public WindTrack getOrCreateWindTrack(WindSource windSource) { protected WindTrack createWindTrack(WindSource windSource, long delayForWindEstimationCacheInvalidation) {
WindTrack result = super.getOrCreateWindTrack(windSource); WindTrack result = super.createWindTrack(windSource, delayForWindEstimationCacheInvalidation);
if (windSource.getType().canBeStored()) { if (windSource.getType().canBeStored()) {
// replicate all wind fixes that may have been loaded by the wind store // replicate all wind fixes that may have been loaded by the wind store
result.lockForRead(); result.lockForRead();