Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
close endpoints correctly, add more logs for tests
Browse files Browse the repository at this point in the history
jrhee17 committed Aug 5, 2024
1 parent 9798317 commit b309e01
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions testing-internal/src/main/resources/logback-test.xml
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@
<logger name="com.linecorp.armeria.logging.traffic.client" level="OFF" />
<logger name="com.linecorp.armeria.logging.traffic.client.http2" level="OFF" />
<logger name="com.linecorp.armeria.internal.common.Http2GoAwayHandler" level="INFO" />
<logger name="com.linecorp.armeria.xds.client" level="TRACE" />
<logger name="io.netty.resolver.dns.TraceDnsQueryLifeCycleObserverFactory" level="DEBUG" />
<logger name="reactor" level="INFO" />
<logger name="io.envoyproxy.controlplane.cache" level="DEBUG" />
Original file line number Diff line number Diff line change
@@ -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<Endpoint, Attributes> prevAttrsMap;
private final List<AttributeKey<Object>> interestedKeys;
private final EndpointGroup delegate;

@SuppressWarnings("unchecked")
AttributeRetainingEndpointGroup(EndpointGroup delegate, Map<Endpoint, Attributes> prevAttrsMap,
AttributeKey<?>... interestedKeys) {
this.prevAttrsMap = prevAttrsMap;
this.interestedKeys = ImmutableList.copyOf((AttributeKey<Object>[]) interestedKeys);
this.delegate = delegate;
delegate.addListener(this, true);
}

@@ -60,4 +63,9 @@ public void accept(List<Endpoint> endpoints) {
}
setEndpoints(endpointsBuilder.build());
}

@Override
protected void doCloseAsync(CompletableFuture<?> future) {
delegate.closeAsync().handle((ignored, t) -> future.complete(null));
}
}
Original file line number Diff line number Diff line change
@@ -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<Endpoint> endpoints) {
.collect(Collectors.toList());
setEndpoints(mappedEndpoints);
}

@Override
protected void doCloseAsync(CompletableFuture<?> future) {
delegate.closeAsync().handle((ignored, t) -> future.complete(null));
}
}

0 comments on commit b309e01

Please sign in to comment.