diff --git a/testing-internal/src/main/resources/logback-test.xml b/testing-internal/src/main/resources/logback-test.xml index f1bd6c984bcc..4daa408a24c4 100644 --- a/testing-internal/src/main/resources/logback-test.xml +++ b/testing-internal/src/main/resources/logback-test.xml @@ -34,6 +34,7 @@ + diff --git a/xds/src/main/java/com/linecorp/armeria/xds/client/endpoint/AttributeRetainingEndpointGroup.java b/xds/src/main/java/com/linecorp/armeria/xds/client/endpoint/AttributeRetainingEndpointGroup.java index fd65ecde965b..5458bfaa2fa9 100644 --- a/xds/src/main/java/com/linecorp/armeria/xds/client/endpoint/AttributeRetainingEndpointGroup.java +++ b/xds/src/main/java/com/linecorp/armeria/xds/client/endpoint/AttributeRetainingEndpointGroup.java @@ -18,6 +18,7 @@ import java.util.List; import java.util.Map; +import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; import com.google.common.collect.ImmutableList; @@ -33,12 +34,14 @@ final class AttributeRetainingEndpointGroup extends DynamicEndpointGroup impleme private final Map prevAttrsMap; private final List> interestedKeys; + private final EndpointGroup delegate; @SuppressWarnings("unchecked") AttributeRetainingEndpointGroup(EndpointGroup delegate, Map prevAttrsMap, AttributeKey... interestedKeys) { this.prevAttrsMap = prevAttrsMap; this.interestedKeys = ImmutableList.copyOf((AttributeKey[]) interestedKeys); + this.delegate = delegate; delegate.addListener(this, true); } @@ -60,4 +63,9 @@ public void accept(List endpoints) { } setEndpoints(endpointsBuilder.build()); } + + @Override + protected void doCloseAsync(CompletableFuture future) { + delegate.closeAsync().handle((ignored, t) -> future.complete(null)); + } } diff --git a/xds/src/main/java/com/linecorp/armeria/xds/client/endpoint/XdsAttributeAssigningEndpointGroup.java b/xds/src/main/java/com/linecorp/armeria/xds/client/endpoint/XdsAttributeAssigningEndpointGroup.java index 5b3b27d2192e..06067144b827 100644 --- a/xds/src/main/java/com/linecorp/armeria/xds/client/endpoint/XdsAttributeAssigningEndpointGroup.java +++ b/xds/src/main/java/com/linecorp/armeria/xds/client/endpoint/XdsAttributeAssigningEndpointGroup.java @@ -20,6 +20,7 @@ import static com.linecorp.armeria.xds.client.endpoint.XdsAttributeKeys.LOCALITY_LB_ENDPOINTS_KEY; import java.util.List; +import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; import java.util.stream.Collectors; @@ -35,11 +36,13 @@ final class XdsAttributeAssigningEndpointGroup extends DynamicEndpointGroup private final LocalityLbEndpoints localityLbEndpoints; private final LbEndpoint lbEndpoint; + private final EndpointGroup delegate; XdsAttributeAssigningEndpointGroup(EndpointGroup delegate, LocalityLbEndpoints localityLbEndpoints, LbEndpoint lbEndpoint) { this.localityLbEndpoints = localityLbEndpoints; this.lbEndpoint = lbEndpoint; + this.delegate = delegate; delegate.addListener(this, true); } @@ -53,4 +56,9 @@ public void accept(List endpoints) { .collect(Collectors.toList()); setEndpoints(mappedEndpoints); } + + @Override + protected void doCloseAsync(CompletableFuture future) { + delegate.closeAsync().handle((ignored, t) -> future.complete(null)); + } }