MCPcopy Create free account
hub / github.com/apache/solr / runImpl

Method runImpl

solr/core/src/java/org/apache/solr/cli/ZkRmTool.java:54–86  ·  view source on GitHub ↗
(CommandLine cli)

Source from the content-addressed store, hash-verified

52 }
53
54 @Override
55 public void runImpl(CommandLine cli) throws Exception {
56 String zkHost = CLIUtils.getZkHost(cli);
57
58 String target = cli.getArgs()[0];
59 boolean recursive = cli.hasOption(CommonCLIOptions.RECURSIVE_OPTION);
60
61 String znode = target;
62 if (target.toLowerCase(Locale.ROOT).startsWith("zk:")) {
63 znode = target.substring(3);
64 }
65 if (znode.equals("/")) {
66 throw new SolrServerException("You may not remove the root ZK node ('/')!");
67 }
68 echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ...");
69 try (SolrZkClient zkClient = CLIUtils.getSolrZkClient(cli, zkHost)) {
70 if (!recursive && !zkClient.getChildren(znode, null).isEmpty()) {
71 throw new SolrServerException(
72 "ZooKeeper node " + znode + " has children and recursive has NOT been specified.");
73 }
74 echo(
75 "Removing ZooKeeper node "
76 + znode
77 + " from ZooKeeper at "
78 + zkHost
79 + " recursive: "
80 + recursive);
81 zkClient.clean(znode);
82 } catch (Exception e) {
83 log.error("Could not complete rm operation for reason: ", e);
84 throw (e);
85 }
86 }
87}

Callers

nothing calls this directly

Calls 11

getZkHostMethod · 0.95
getSolrZkClientMethod · 0.95
echoIfVerboseMethod · 0.80
echoMethod · 0.80
cleanMethod · 0.65
getArgsMethod · 0.45
substringMethod · 0.45
equalsMethod · 0.45
isEmptyMethod · 0.45
getChildrenMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected