Do not retain leaf nodes in containers by default
Leaf nodes are observed to dominate our memory footprint. This
patch modifies immutable implementations of NormalizedNodeContainers
such that they eliminate any leaf nodes when they are stored, retaining
only the encapsulated value. Leaf nodes are then re-created on access
as needed.
Note this changes two aspects of operation:
1) looking up a leaf will yield a new object every time it is invoked,
hence callers must not rely on on returned objects to be identical.
2) getValue() is operating on the backing map's entrySet() and requires
its transformation. This means that multiple iterations over values
will not necessarily yield same objects.
Neither of these violates effective immutability contract of NormalizeNode,
as the returned objects will compare as equal.
This behavior can be switched off at runtime by setting the system property:
org.opendaylight.yangtools.yang.data.impl.schema.nodes.lazy-leaves=false
JIRA: YANGTOOLS-1019
Change-Id: I00fc3ac0b64290068e8a6e4c8972454729fa9011
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>