You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2019/08/29 11:32:45 UTC
[skywalking] branch master updated: Fix the zookeeper plugin has
many nodes in the cluster case (#3372)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new 95ceacf Fix the zookeeper plugin has many nodes in the cluster case (#3372)
95ceacf is described below
commit 95ceacfc158830edde8e80714cecf780b8a0396a
Author: 于玉桔 <zh...@apache.org>
AuthorDate: Thu Aug 29 19:32:37 2019 +0800
Fix the zookeeper plugin has many nodes in the cluster case (#3372)
* Fix the zookeeper plugin has many nodes in the cluster case
* support version
---
.../apm/plugin/zookeeper/ClientCnxnInterceptor.java | 11 +++++++++--
docs/en/setup/service-agent/java-agent/Supported-list.md | 2 +-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/apm-sniffer/optional-plugins/zookeeper-3.4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/zookeeper/ClientCnxnInterceptor.java b/apm-sniffer/optional-plugins/zookeeper-3.4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/zookeeper/ClientCnxnInterceptor.java
index 7e5d3a3..e19f0d6 100644
--- a/apm-sniffer/optional-plugins/zookeeper-3.4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/zookeeper/ClientCnxnInterceptor.java
+++ b/apm-sniffer/optional-plugins/zookeeper-3.4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/zookeeper/ClientCnxnInterceptor.java
@@ -37,6 +37,8 @@ import org.apache.zookeeper.proto.RequestHeader;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
/**
@@ -82,9 +84,14 @@ public class ClientCnxnInterceptor implements InstanceMethodsAroundInterceptor,
field.setAccessible(true);
@SuppressWarnings("unchecked")
List<InetSocketAddress> serverAddresses = (List<InetSocketAddress>) field.get(hostProvider);
- StringBuilder peer = new StringBuilder();
+ List<String> addresses = new ArrayList<String>();
for (InetSocketAddress address : serverAddresses) {
- peer.append(address.getHostName()).append(":").append(address.getPort()).append(";");
+ addresses.add(address.getHostName() + ":" + address.getPort());
+ }
+ Collections.sort(addresses);
+ StringBuilder peer = new StringBuilder();
+ for (String address : addresses) {
+ peer.append(address).append(";");
}
objInst.setSkyWalkingDynamicField(peer.toString());
} catch (NoSuchFieldException e) {
diff --git a/docs/en/setup/service-agent/java-agent/Supported-list.md b/docs/en/setup/service-agent/java-agent/Supported-list.md
index 73566be..fc333b9 100644
--- a/docs/en/setup/service-agent/java-agent/Supported-list.md
+++ b/docs/en/setup/service-agent/java-agent/Supported-list.md
@@ -60,7 +60,7 @@
* Service Discovery
* [Netflix Eureka](https://github.com/Netflix/eureka)
* Distributed Coordination
- * [Zookeeper](https://github.com/apache/zookeeper) 3.4.x (Optional² & Except 3.4.4)
+ * [Zookeeper](https://github.com/apache/zookeeper) 3.4.0+ (Optional² & Except 3.4.4)
* Spring Ecosystem
* Spring Bean annotations(@Bean, @Service, @Component, @Repository) 3.x and 4.x (Optional²)
* Spring Core Async SuccessCallback/FailureCallback/ListenableFutureCallback 4.x