From fbfbbd619a68b3af46e752f719a8d863c7ac031e Mon Sep 17 00:00:00 2001 From: Bela Ban Date: Mon, 8 Jan 2024 17:55:35 +0100 Subject: [PATCH] Added "member-addrs" to GossipRouter's probe handler (https://issues.redhat.com/browse/JGRP-2745) --- src/org/jgroups/stack/GossipRouter.java | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/org/jgroups/stack/GossipRouter.java b/src/org/jgroups/stack/GossipRouter.java index 4aabc7fdd2..8e09492276 100644 --- a/src/org/jgroups/stack/GossipRouter.java +++ b/src/org/jgroups/stack/GossipRouter.java @@ -18,10 +18,7 @@ import javax.net.ssl.*; import java.io.DataInput; -import java.net.Inet6Address; -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.UnknownHostException; +import java.net.*; import java.nio.ByteBuffer; import java.util.*; import java.util.concurrent.ConcurrentHashMap; @@ -422,13 +419,27 @@ public Map handleProbe(String... keys) { } } map.put(key, sb.toString()); + continue; + } + if(key.startsWith("member-addrs")) { + InetSocketAddress sa=(InetSocketAddress)diag.getLocalAddress(); + if(sa != null) { + Set physical_addrs=Set.of(new IpAddress(sa.getAddress(), sa.getPort())); + // Set physical_addrs=diag.getLocalAddress(); + String list=Util.print(physical_addrs); + map.put(key, list); + } + continue; + } + if(key.startsWith("dump")) { + map.put(key, Util.dumpThreads()); } } return map; } public String[] supportedKeys() { - return new String[]{"ops", "op", "invoke", "keys"}; + return new String[]{"ops", "op", "invoke", "keys", "member-addrs", "dump"}; } protected ByteArrayDataOutputStream getOutputStream(Address mbr, int size) {