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

Method runImpl

solr/core/src/java/org/apache/solr/cli/ClusterTool.java:72–99  ·  view source on GitHub ↗
(CommandLine cli)

Source from the content-addressed store, hash-verified

70 }
71
72 @Override
73 public void runImpl(CommandLine cli) throws Exception {
74
75 String propertyName = cli.getOptionValue(PROPERTY_OPTION);
76 String propertyValue = cli.getOptionValue(VALUE_OPTION);
77 String zkHost = CLIUtils.getZkHost(cli);
78
79 if (!ZkController.checkChrootPath(zkHost, true)) {
80 throw new IllegalStateException(
81 "A chroot was specified in zkHost but the znode doesn't exist.");
82 }
83
84 try (SolrZkClient zkClient =
85 new SolrZkClient.Builder()
86 .withUrl(zkHost)
87 .withTimeout(SolrZkClientTimeout.DEFAULT_ZK_CLIENT_TIMEOUT, TimeUnit.MILLISECONDS)
88 .build()) {
89
90 ClusterProperties props = new ClusterProperties(zkClient);
91 try {
92 props.setClusterProperty(propertyName, propertyValue);
93 } catch (IOException ex) {
94 throw new Exception(
95 "Unable to set the cluster property due to following error : "
96 + ex.getLocalizedMessage());
97 }
98 }
99 }
100}

Callers

nothing calls this directly

Calls 6

getZkHostMethod · 0.95
checkChrootPathMethod · 0.95
setClusterPropertyMethod · 0.95
withTimeoutMethod · 0.80
withUrlMethod · 0.80
buildMethod · 0.65

Tested by

no test coverage detected