Fixed closing of cache storage

#KTIJ-7680 Fixed
#KT-45843 Fixed
This commit is contained in:
Aleksei.Cherepanov
2021-05-19 16:49:36 +03:00
committed by teamcityserver
parent 886ce055f5
commit ee45aa6b08
3 changed files with 12 additions and 3 deletions

View File

@@ -47,7 +47,8 @@ abstract class BasicMap<K : Comparable<K>, V>(
storage.flush(memoryCachesOnly)
}
fun close() {
// avoid unsynchronized close
internal fun close() {
storage.close()
}

View File

@@ -103,7 +103,11 @@ class CachingLazyStorage<K, V>(
@Synchronized
override fun close() {
storage?.close()
try {
storage?.close()
} finally {
storage = null
}
}
private fun createMap(): PersistentHashMap<K, V> = PersistentHashMap(storageFile, keyDescriptor, valueExternalizer)

View File

@@ -100,7 +100,11 @@ class NonCachingLazyStorage<K, V>(
@Synchronized
override fun close() {
storage?.close()
try {
storage?.close()
} finally {
storage = null
}
}
private fun createMap(): PersistentHashMap<K, V> =