diff --git a/src/main/java/org/opensearch/knn/index/memory/NativeMemoryCacheManager.java b/src/main/java/org/opensearch/knn/index/memory/NativeMemoryCacheManager.java index 28d25fbf6..e61a6ee77 100644 --- a/src/main/java/org/opensearch/knn/index/memory/NativeMemoryCacheManager.java +++ b/src/main/java/org/opensearch/knn/index/memory/NativeMemoryCacheManager.java @@ -109,6 +109,7 @@ private void initialize(NativeMemoryCacheManagerDto nativeMemoryCacheDTO) { try { cache.cleanUp(); } catch (Exception e) { + // Exceptions from Guava shouldn't halt the executor logger.error("Error cleaning up cache", e); } }; diff --git a/src/main/java/org/opensearch/knn/quantization/models/quantizationState/QuantizationStateCache.java b/src/main/java/org/opensearch/knn/quantization/models/quantizationState/QuantizationStateCache.java index 045c5192c..74fe2e0d2 100644 --- a/src/main/java/org/opensearch/knn/quantization/models/quantizationState/QuantizationStateCache.java +++ b/src/main/java/org/opensearch/knn/quantization/models/quantizationState/QuantizationStateCache.java @@ -83,6 +83,7 @@ private void buildCache() { try { cache.cleanUp(); } catch (Exception e) { + // Exceptions from Guava shouldn't halt the executor log.error("Error cleaning up cache", e); } }; diff --git a/src/main/java/org/opensearch/knn/quantization/models/quantizationState/QuantizationStateCacheManager.java b/src/main/java/org/opensearch/knn/quantization/models/quantizationState/QuantizationStateCacheManager.java index 193abed80..63282029a 100644 --- a/src/main/java/org/opensearch/knn/quantization/models/quantizationState/QuantizationStateCacheManager.java +++ b/src/main/java/org/opensearch/knn/quantization/models/quantizationState/QuantizationStateCacheManager.java @@ -9,10 +9,11 @@ import lombok.NoArgsConstructor; import org.opensearch.knn.index.codec.KNN990Codec.KNN990QuantizationStateReader; +import java.io.Closeable; import java.io.IOException; @NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class QuantizationStateCacheManager { +public final class QuantizationStateCacheManager implements Closeable { private static volatile QuantizationStateCacheManager instance; @@ -80,6 +81,7 @@ public void clear() { QuantizationStateCache.getInstance().clear(); } + @Override public void close() throws IOException { QuantizationStateCache.getInstance().close(); }