mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
Modify the fingerprinter not to use ConcurrentHashMap.computeIfAbsent() because we cannot guarantee that the cache is not reentered by the computation.
This commit is contained in:
parent
a5d5e0d476
commit
99074b5a49
@ -36,11 +36,15 @@ class TypeModellingFingerPrinter(
|
||||
private val cache: MutableMap<TypeIdentifier, String> = DefaultCacheProvider.createCache()
|
||||
|
||||
override fun fingerprint(typeInformation: LocalTypeInformation): String =
|
||||
cache.computeIfAbsent(typeInformation.typeIdentifier) {
|
||||
FingerPrintingState(
|
||||
customTypeDescriptorLookup,
|
||||
FingerprintWriter(debugEnabled)).fingerprint(typeInformation)
|
||||
}
|
||||
/*
|
||||
* We cannot use ConcurrentMap.computeIfAbsent() here because it requires
|
||||
* that the map not be re-entered during the computation function. And
|
||||
* the Fingerprinter cannot guarantee that.
|
||||
*/
|
||||
cache.getOrPut(typeInformation.typeIdentifier) {
|
||||
FingerPrintingState(customTypeDescriptorLookup, FingerprintWriter(debugEnabled))
|
||||
.fingerprint(typeInformation)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user