ENT-12070 System property feature flag for AMQP Serialization performance improvements (#7838)

This commit is contained in:
Rick Parker 2024-10-11 13:33:01 +01:00 committed by GitHub
parent 852127c648
commit 9bc1ee1ad5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -283,12 +283,18 @@ class DefaultLocalSerializerFactory(
}
private val schemaCache = ConcurrentHashMap<Set<TypeNotation>, Pair<Schema, TransformsSchema>>()
private val schemaCachingDisabled: Boolean = java.lang.Boolean.getBoolean("net.corda.serialization.disableSchemaCaching")
override fun getCachedSchema(types: Set<TypeNotation>): Pair<Schema, TransformsSchema> {
val cacheKey = CachingSet(types)
return schemaCache.getOrPut(cacheKey) {
val schema = Schema(cacheKey.toList())
return if (schemaCachingDisabled) {
val schema = Schema(types.toList())
schema to TransformsSchema.build(schema, this)
} else {
val cacheKey = CachingSet(types)
schemaCache.getOrPut(cacheKey) {
val schema = Schema(cacheKey.toList())
schema to TransformsSchema.build(schema, this)
}
}
}