MCPcopy Create free account
hub / github.com/belaban/JGroups / handleProbe

Method handleProbe

src/org/jgroups/stack/ProtocolStack.java:53–176  ·  view source on GitHub ↗
(String... keys)

Source from the content-addressed store, hash-verified

51 protected final DiagnosticsHandler.ProbeHandler props_handler=new DiagnosticsHandler.ProbeHandler() {
52
53 public Map<String, String> handleProbe(String... keys) {
54 for(String key: keys) {
55 if(Objects.equals(key, "props")) {
56 String tmp=printProtocolSpec(true);
57 HashMap<String, String> map=new HashMap<>(1);
58 map.put("props", tmp);
59 return map;
60 }
61 if(key.startsWith(max_list_print_size)) {
62 int index=key.indexOf('=');
63 if(index >= 0) {
64 Util.MAX_LIST_PRINT_SIZE=Integer.parseInt(key.substring(index+1));
65 }
66 HashMap<String, String> map=new HashMap<>(1);
67 map.put(max_list_print_size, String.valueOf(Util.MAX_LIST_PRINT_SIZE));
68 return map;
69 }
70 if(key.equals("pp") || key.startsWith("print-protocols")) {
71 List<Protocol> prots=getProtocols();
72 Collections.reverse(prots);
73 StringBuilder sb=new StringBuilder();
74 for(Protocol prot: prots)
75 sb.append(prot.getName()).append("\n");
76 HashMap<String, String> map=new HashMap<>(1);
77 map.put("protocols", sb.toString());
78 return map;
79 }
80 if(key.startsWith("rp") || key.startsWith("remove-protocol")) {
81 int len=key.startsWith("rp")? "rp".length() : "remove-protocol".length();
82 key=key.substring(len);
83 int index=key.indexOf('=');
84 if(index != -1) {
85 String rest=key.substring(index +1);
86 if(rest != null && !rest.isEmpty()) {
87 List<String> prots=Util.parseCommaDelimitedStrings(rest);
88 if(!prots.isEmpty()) {
89 for(String p: prots) {
90 List<Protocol> protocols=findProtocols(p);
91 if(protocols != null && !protocols.isEmpty()) {
92 for(Protocol prot_to_remove: protocols) {
93 try {
94 Protocol removed=removeProtocol(prot_to_remove);
95 if(removed != null)
96 log.debug("removed protocol %s from stack", prot_to_remove.getName());
97 }
98 catch(Exception e) {
99 log.error(Util.getMessage("FailedRemovingProtocol") + rest, e);
100 }
101 }
102 }
103 }
104 }
105 }
106 }
107 }
108 if(key.equalsIgnoreCase("ra") || key.startsWith("remove-all")) { // remove all protocols but the transport
109 List<Protocol> protocols=getProtocols();
110 for(Protocol p: protocols) {

Callers

nothing calls this directly

Calls 15

printProtocolSpecMethod · 0.95
getProtocolsMethod · 0.95
getNameMethod · 0.95
findProtocolsMethod · 0.95
removeProtocolMethod · 0.95
getMessageMethod · 0.95
findProtocolMethod · 0.95
createProtocolMethod · 0.95
insertProtocolMethod · 0.95
callAfterCreationHookMethod · 0.95
initMethod · 0.95

Tested by

no test coverage detected