[YANGTOOLS-1252] Improve SharedSchemaContextFactory Created: 17/Feb/21  Updated: 03/Jun/21  Resolved: 19/Feb/21

Status: Resolved
Project: yangtools
Component/s: parser
Affects Version/s: None
Fix Version/s: 7.0.0

Type: Improvement Priority: High
Reporter: Robert Varga Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to YANGTOOLS-1293 Do not keep negative cache in SharedE... Resolved

 Description   

SharedSchemaContextFactory is widely used for caching context. Unfortunately it has a major deficiency around first computation: if multiple requests enter resolution process, we end up computing the schema context concurrent and only deduplicate it afterwards.

Refactor the implementation to remember futures, so concurrent accesses end up waiting for the initial computation to finish. This requires some fancy dance around references, as the indirection in cache values will mean that soft references will clean up on Future not being referenced, rather than the context not being referenced.


Generated at Wed Feb 07 20:55:37 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.