(String... keys)
| 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) { |
nothing calls this directly
no test coverage detected