Rework DataNodeContainerModificationStrategy child tracking 56/80156/2
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 5 Feb 2019 11:11:05 +0000 (12:11 +0100)
committerRobert Varga <nite@hq.sk>
Tue, 5 Feb 2019 13:21:55 +0000 (13:21 +0000)
commit29b7c9225a5fbfa7c23a95fc066388ab43d269ed
treeba99f87f1579abc3dfe38b49750dbb791b8c5993
parentbb5406f87ab2d1419a09d3c90a46f49591562ce2
Rework DataNodeContainerModificationStrategy child tracking

Since we do not want to expand the entire modification tree, but
instantiate it lazily, we have used a Guava LoadingCache to load
children.

Unfortunately this has couple of disadvantanges, namely:
- memory overhead of the cache and its entries
- access through a ConcurrentHashMap
- synchronized entry loading

As it turns out, we can do much better by maintaining an immutable
map ourselves, with compare-and-swap locking. This results in
much lower memory overhead as well as fast access, as we perform
only a single volatile read in that case.

JIRA: YANGTOOLS-950
Change-Id: I7b8c6d6561d65373e54cf5a5dd9f0bc2537531ac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/DataNodeContainerModificationStrategy.java