From 0e27a4a5ed94fbd4c5083d32ef2790e17c320dec Mon Sep 17 00:00:00 2001 From: lingting Date: Thu, 28 Mar 2024 00:33:11 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E7=BB=93=E6=9E=9C=E4=B8=AD=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E9=9D=9EGRPC=E5=8D=8F=E8=AE=AE=E5=AE=9E=E4=BE=8B=20(#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../polaris/grpc/resolver/PolarisNameResolver.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/grpc-java-polaris/src/main/java/com/tencent/polaris/grpc/resolver/PolarisNameResolver.java b/grpc-java-polaris/src/main/java/com/tencent/polaris/grpc/resolver/PolarisNameResolver.java index 7313325..7f90c9f 100644 --- a/grpc-java-polaris/src/main/java/com/tencent/polaris/grpc/resolver/PolarisNameResolver.java +++ b/grpc-java-polaris/src/main/java/com/tencent/polaris/grpc/resolver/PolarisNameResolver.java @@ -149,10 +149,12 @@ private void doWatch(Listener2 listener) { private void notifyListener(Listener2 listener, InstancesResponse response) { ServiceInstances serviceInstances = response.toServiceInstances(); - List equivalentAddressGroups = serviceInstances.getInstances() - .stream() - .map(this::buildEquivalentAddressGroup) - .collect(Collectors.toList()); + List equivalentAddressGroups = new ArrayList<>(); + for (Instance instance : serviceInstances.getInstances()) { + if (Objects.equals("grpc", instance.getProtocol())) { + equivalentAddressGroups.add(buildEquivalentAddressGroup(instance)); + } + } Attributes.Builder builder = Attributes.newBuilder();