Github user dragonsinth commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/32#discussion_r61503724
--- Diff:
solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java ---
@@ -572,6 +574,40 @@ public void downloadConfig(String configName, Path
downloadPath) throws IOExcept
zkStateReader.getConfigManager().downloadConfigDir(configName,
downloadPath);
}
+ /**
+ * Block until a collection state matches a predicate, or a timeout
+ *
+ * Note that the predicate may be called again even after it has
returned true, so
+ * implementors should avoid changing state within the predicate call
itself.
+ *
+ * @param collection the collection to watch
+ * @param wait how long to wait
+ * @param unit the units of the wait parameter
+ * @param predicate a {@link CollectionStatePredicate} to check the
collection state
+ * @throws InterruptedException on interrupt
+ * @throws TimeoutException on timeout
+ */
+ public void waitForState(String collection, long wait, TimeUnit unit,
CollectionStatePredicate predicate)
+ throws InterruptedException, TimeoutException {
+ connect();
+ zkStateReader.waitForState(collection, wait, unit, predicate);
+ }
+
+ /**
+ * Register a CollectionStateWatcher to be called when the cluster state
for a collection changes
+ *
+ * Note that the watcher is unregistered after it has been called once.
To make a watcher persistent,
+ * it should re-register itself in its {@link
CollectionStateWatcher#onStateChanged(Set, DocCollection)}
+ * call
+ *
+ * @param collection the collection to watch
+ * @param watcher a watcher that will be called when the state changes
+ */
+ public void registerCollectionStateWatcher(String collection,
CollectionStateWatcher watcher) {
+ connect();
+ zkStateReader.registerCollectionStateWatcher(collection, watcher);
+ }
+
--- End diff --
I would note that getZkStateReader() is a public method, is there value in
adding these forwarding methods?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]