Rework DataNodeContainerModificationStrategy child tracking 52/80152/3
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 5 Feb 2019 11:11:05 +0000 (12:11 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 5 Feb 2019 13:18:59 +0000 (14:18 +0100)
commitbf82d3009c7587f9602491523321dcf2154d08d2
tree65a4c386a23591d709f5719b39f578bbab586064
parentd3ea78c642c428f640ab29f8f197a65e4c4477e1
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