From 2a810b8e6fe88ceef3ef781bfddef79829834b45 Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Mon, 16 May 2016 14:51:53 +0200 Subject: Fix interface dump caching Change-Id: I18d29bebf754c34bbc05e5c9cfb78d8aba87c205 Signed-off-by: Marek Gradzki --- .../v3po/translate/v3po/interfacesstate/InterfaceCustomizer.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceCustomizer.java') diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceCustomizer.java index 82e114603..51d4022d7 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterfaceCustomizer.java @@ -23,6 +23,7 @@ import io.fd.honeycomb.v3po.translate.v3po.util.FutureJVppCustomizer; import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; import io.fd.honeycomb.v3po.translate.v3po.utils.V3poUtils; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; @@ -72,11 +73,9 @@ public class InterfaceCustomizer extends FutureJVppCustomizer LOG.debug("Reading attributes for interface: {}", id); final InterfaceKey key = id.firstKeyOf(id.getTargetType()); - final Map cachedDump = getCachedInterfaceDump(ctx); - // Pass cached details from getAllIds to getDetails to avoid additional dumps final SwInterfaceDetails iface = InterfaceUtils.getVppInterfaceDetails(getFutureJVpp(), key, - interfaceContext.getIndex(key.getName()), cachedDump); + interfaceContext.getIndex(key.getName()), ctx); LOG.debug("Interface details for interface: {}, details: {}", key.getName(), iface); builder.setName(key.getName()); @@ -97,7 +96,7 @@ public class InterfaceCustomizer extends FutureJVppCustomizer @SuppressWarnings("unchecked") public static Map getCachedInterfaceDump(final @Nonnull Context ctx) { return ctx.get(DUMPED_IFCS_CONTEXT_KEY) == null - ? Collections.emptyMap() + ? new HashMap<>() // allow customizers to update the cache : (Map) ctx.get(DUMPED_IFCS_CONTEXT_KEY); } -- cgit 1.2.3-korg