Skip to content

Commit

Permalink
ZOOKEEPER-4464: zooinspector display "Ephemeral Owner" in hex for eas…
Browse files Browse the repository at this point in the history
…y match to jmx session

zooinspector now show "Ephemeral Owner" in 10 base number while JMX connections show in hex format. this makes it a little hard to match them.

It will be much better if hex format is shown too, I will create a pr add hex format just beside the 10 based one.

Author: 67 <67@gd67.com>

Reviewers: Enrico Olivelli <eolivelli@apache.org>, Mohammad Arshad <arshad@apache.org>, Mate Szalay-Beko <symat@apache.org>

Closes apache#1813 from iamgd67/ZOOKEEPER-4464
  • Loading branch information
iamgd67 authored and symat committed Mar 29, 2022
1 parent a160981 commit d7cb4e8
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected void done() {
for (Map.Entry<String, String> entry : data.entrySet()) {
rowPos = 2 * i + 1;
JLabel label = new JLabel(entry.getKey());
JTextField text = new JTextField(entry.getValue());
JTextField text = new JTextField(formatValByKeyType(entry.getKey(),entry.getValue()));
text.setEditable(false);
GridBagConstraints c1 = new GridBagConstraints();
c1.gridx = 0;
Expand Down Expand Up @@ -164,6 +164,21 @@ protected void done() {
NodeViewerMetaData.this.metaDataPanel.revalidate();
NodeViewerMetaData.this.metaDataPanel.repaint();
}

private String formatValByKeyType(String key, String value) {
if(key==null) return value;
String formatedVal=value;
switch (key){
case "Ephemeral Owner":
try{
formatedVal = String.format("0x%x", Long.parseLong(value));
}catch (NumberFormatException e){
LoggerFactory.getLogger().warn("parse {}'s value {} to hex fail",key,value,e);
}
break;
}
return formatedVal;
}
};
worker.execute();
}
Expand Down

0 comments on commit d7cb4e8

Please sign in to comment.