From f05cd53e9d60d389af80eedd6774aa0b567dbdd5 Mon Sep 17 00:00:00 2001 From: Rohit Lakde <37445331+rlakde@users.noreply.github.com> Date: Mon, 4 Nov 2024 19:38:38 -0600 Subject: [PATCH] Correct removeExtensionFromCache. --- .../com/here/naksha/lib/extmanager/ExtensionCache.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/here-naksha-lib-ext-manager/src/main/java/com/here/naksha/lib/extmanager/ExtensionCache.java b/here-naksha-lib-ext-manager/src/main/java/com/here/naksha/lib/extmanager/ExtensionCache.java index fa235f106..e38b9729b 100644 --- a/here-naksha-lib-ext-manager/src/main/java/com/here/naksha/lib/extmanager/ExtensionCache.java +++ b/here-naksha-lib-ext-manager/src/main/java/com/here/naksha/lib/extmanager/ExtensionCache.java @@ -112,9 +112,8 @@ private void publishIntoCache(KVPair result, ExtensionConfig ex if (!isNullOrEmpty(extension.getInitClassName())) { try { Class clz = loader.loadClass(extension.getInitClassName()); - Object obj = clz.getConstructor(INaksha.class, Extension.class).newInstance(naksha, extension); + Object obj = clz.getConstructor().newInstance(); if (obj instanceof IExtensionInit initInstance) { - initInstance.close(); initInstance.init(naksha, extension); instance = initInstance; } else { @@ -152,15 +151,12 @@ private void removeExtensionFromCache(String extensionId) { ValueTuple valueTuple = loaderCache.get(extensionId); if (valueTuple != null) { IExtensionInit instance = valueTuple.getInstance(); - Extension extension = valueTuple.getExtension(); - final String extensionIdWithEnv = extension.getEnv() + ":" + extension.getId(); - if (instance != null) { try { instance.close(); - logger.info("Extension {} closed successfully.", extensionIdWithEnv); + logger.info("Extension {} closed successfully.", extensionId); } catch (Exception e) { - logger.error("Failed to close extension {}", extensionIdWithEnv, e); + logger.error("Failed to close extension {}", extensionId, e); } }