From fa46f7bbb0bf0649fe081adc9d102282ce74f3a1 Mon Sep 17 00:00:00 2001 From: minwoox Date: Fri, 27 Sep 2024 19:10:40 +0900 Subject: [PATCH] Address comments from @ikhoon --- .../xds/k8s/v1/XdsKubernetesEndpointFetchingService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xds/src/main/java/com/linecorp/centraldogma/xds/k8s/v1/XdsKubernetesEndpointFetchingService.java b/xds/src/main/java/com/linecorp/centraldogma/xds/k8s/v1/XdsKubernetesEndpointFetchingService.java index 5664564025..b319d346ff 100644 --- a/xds/src/main/java/com/linecorp/centraldogma/xds/k8s/v1/XdsKubernetesEndpointFetchingService.java +++ b/xds/src/main/java/com/linecorp/centraldogma/xds/k8s/v1/XdsKubernetesEndpointFetchingService.java @@ -141,6 +141,8 @@ protected void handleXdsResource(String path, String contentAsText, String group updaters.put(watcherName, updater); future.handle((kubernetesEndpointGroup, cause) -> { if (cause != null) { + logger.warn("Unexpected exception while creating a KubernetesEndpointGroup in fetching service", + cause); // Do not remove the updater from updaters because it can remove the updater that is created // by the next commit. The updater will be removed only when the file or group is removed. updater.close(); @@ -150,7 +152,7 @@ protected void handleXdsResource(String path, String contentAsText, String group if (endpoints.isEmpty()) { return; } - executorService.execute(updater::maybeSchedule); + executorService.execute(() -> updater.maybeSchedule(kubernetesEndpointGroup)); }, true); return null; }); @@ -231,7 +233,7 @@ private static class KubernetesEndpointsUpdater { this.clusterName = clusterName; } - void maybeSchedule() { + void maybeSchedule(KubernetesEndpointGroup kubernetesEndpointGroup) { if (scheduledFuture != null) { return; } @@ -240,7 +242,6 @@ void maybeSchedule() { scheduledFuture = executorService.schedule(() -> { scheduledFuture = null; // maybeSchedule() is called after the future is completed. - final KubernetesEndpointGroup kubernetesEndpointGroup = kubernetesEndpointGroupFuture.join(); if (kubernetesEndpointGroup.isClosing()) { return; }