mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-20 11:10:00 +00:00
fixing bug 3178 by applying the unwinding finally clause also when exception is thrown in computeCacheUpdate, not only in provideNewCacheValue
This commit is contained in:
1 parent
ede8f5e9c0
commit
adfe1fe8c8
1 file changed
+11
-8
@@ -317,16 +317,19 @@ public class SmartFutureCache<K, V, U extends UpdateInterval<U>> {
|
||||
runningAndReadUpdateInterval = true;
|
||||
}
|
||||
try {
|
||||
V preResult = cacheUpdateComputer.computeCacheUpdate(key, updateInterval);
|
||||
final NamedReentrantReadWriteLock lock = getOrCreateLockForKey(key);
|
||||
LockUtil.lockForWrite(lock);
|
||||
try {
|
||||
V result = cacheUpdateComputer.provideNewCacheValue(key, cache.get(key), preResult,
|
||||
updateInterval);
|
||||
cache(key, result);
|
||||
return result;
|
||||
V preResult = cacheUpdateComputer.computeCacheUpdate(key, updateInterval);
|
||||
final NamedReentrantReadWriteLock lock = getOrCreateLockForKey(key);
|
||||
LockUtil.lockForWrite(lock);
|
||||
try {
|
||||
V result = cacheUpdateComputer.provideNewCacheValue(key, cache.get(key), preResult,
|
||||
updateInterval);
|
||||
cache(key, result);
|
||||
return result;
|
||||
} finally {
|
||||
LockUtil.unlockAfterWrite(lock);
|
||||
}
|
||||
} finally {
|
||||
LockUtil.unlockAfterWrite(lock);
|
||||
synchronized (ongoingRecalculations) {
|
||||
boolean newTaskScheduled = false;
|
||||
Pair<U, Set<SettableFuture<Future<V>>>> queued = triggeredAndNotYetScheduled.get(key);
|
||||
|
||||
Reference in new issue
Block a user