Allow builders to optionally use LinkedHashMap 18/81718/4
authorJakub Toth <jtoth@luminanetworks.com>
Tue, 23 Apr 2019 13:46:34 +0000 (06:46 -0700)
committerRobert Varga <nite@hq.sk>
Tue, 30 Apr 2019 11:16:12 +0000 (11:16 +0000)
commit6335bf3e7e821d7ec1c221ffb292000c90b0931a
tree51822407d8e08eb61184f772159dadc3c6e8b732
parent28a24f3d42d7cd334225037c4f36e6ef8c97acdb
Allow builders to optionally use LinkedHashMap

Some devices are unreasonably touchy about the order of children
we send them -- i.e. they expect to encounter direct container
children before seeing any augmented children. While we push them
to NormalizedNode builders in this order, the builders are using
plain HashMaps (and rightfully so) to track them, which means
they can get reordered.

This patch introduces a new system property,
org.opendaylight.yangtools.yang.data.impl.schema.builder.retain-child-order,
which when set to "true" will cause DataContainerBuilders to use
LinkedHashMaps to track children, sacrificing efficiency to retain
the original insertion order.

JIRA: YANGTOOLS-984
Change-Id: Ica1616c3fa93559c6458eba4030a5ceaac7be58a
Signed-off-by: Jakub Toth <jtoth@luminanetworks.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/builder/impl/AbstractImmutableDataContainerNodeBuilder.java