java/com.sap.sailing.domain.racelogtrackingadapter/src/com/sap/sailing/domain/racelogtracking/impl/fixtracker/RegattaLogDeviceMappings.java
... ...
@@ -238,18 +238,22 @@ public abstract class RegattaLogDeviceMappings<ItemT extends WithID> {
238 238
logger.fine(() -> "Device mapping cache miss for mapper " + this + " for device " + device
239 239
+ " and time point " + timePoint + ", determined cachable range "
240 240
+ finalTimeRangeForCache + "; " + cacheHits + " hits, " + cacheMisses + " misses");
241
- cacheUpdateJob = ()->cachedMappings.put(device, new Pair<>(finalTimeRangeForCache, deviceMappingsForCache));
242
- }
243
- });
244
- LockUtil.executeWithWriteLock(mappingsLock, ()->{
245
- if (cacheUpdateJob != null) {
246
- logger.fine(()-> "Device mapping cache miss for mapper " + this + " performs cache update.");
247
- cacheUpdateJob.run();
248
- } else {
249
- logger.fine(() -> "Device mapping cache miss for mapper " + this
250
- + " does not update the cache because the mappings were updated in between");
241
+ if (timeRangeForCache != null) {
242
+ cacheUpdateJob = ()->cachedMappings.put(device, new Pair<>(finalTimeRangeForCache, deviceMappingsForCache));
243
+ }
251 244
}
252 245
});
246
+ if (cacheUpdateJob != null) {
247
+ LockUtil.executeWithWriteLock(mappingsLock, ()->{
248
+ if (cacheUpdateJob != null) {
249
+ logger.fine(()-> "Device mapping cache miss for mapper " + this + " performs cache update.");
250
+ cacheUpdateJob.run();
251
+ } else {
252
+ logger.fine(() -> "Device mapping cache miss for mapper " + this
253
+ + " does not update the cache because the mappings were updated in between");
254
+ }
255
+ });
256
+ }
253 257
}
254 258
255 259
public void forEachItemAndCoveredTimeRanges(final BiConsumer<ItemT, Map<RegattaLogDeviceMappingEvent<ItemT>, MultiTimeRange>> consumer) {