diff options
Diffstat (limited to 'infra/data-impl')
-rw-r--r-- | infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ReadableDataTreeDelegator.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ReadableDataTreeDelegator.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ReadableDataTreeDelegator.java index a7ad88c9f..7c46b4ca4 100644 --- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ReadableDataTreeDelegator.java +++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ReadableDataTreeDelegator.java @@ -131,9 +131,11 @@ public final class ReadableDataTreeDelegator implements ReadableDataManager { checkNotNull(path, "Invalid instance identifier %s. Cannot create BA equivalent.", yangInstanceIdentifier); LOG.debug("OperationalDataTree.readNode(), path={}", path); - final Optional<? extends DataObject> dataObject; + final Optional<? extends DataObject> dataObject = readerRegistry.read(path, ctx); + + // Modification cache should not be used after DOs are read, so we can clear it now to reduce peak footprint. + ctx.getModificationCache().close(); - dataObject = readerRegistry.read(path, ctx); if (dataObject.isPresent()) { final NormalizedNode<?, ?> value = toNormalizedNodeFunction(path).apply(dataObject.get()); return Optional.<NormalizedNode<?, ?>>fromNullable(value); @@ -152,6 +154,10 @@ public final class ReadableDataTreeDelegator implements ReadableDataManager { final Multimap<InstanceIdentifier<? extends DataObject>, ? extends DataObject> dataObjects = readerRegistry.readAll(ctx); + // Modification cache should not be used after DOs are read, so we can clear it now to reduce peak footprint. + // Even greater reduction can be achieved with HONEYCOMB-361. + ctx.getModificationCache().close(); + for (final InstanceIdentifier<? extends DataObject> instanceIdentifier : dataObjects.keySet()) { final YangInstanceIdentifier rootElementId = serializer.toYangInstanceIdentifier(instanceIdentifier); final NormalizedNode<?, ?> node = |