[ 
https://issues.apache.org/jira/browse/SOLR-8323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15263015#comment-15263015
 ] 

ASF GitHub Bot commented on SOLR-8323:
--------------------------------------

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?


> Add CollectionWatcher API to ZkStateReader
> ------------------------------------------
>
>                 Key: SOLR-8323
>                 URL: https://issues.apache.org/jira/browse/SOLR-8323
>             Project: Solr
>          Issue Type: Improvement
>    Affects Versions: master
>            Reporter: Alan Woodward
>            Assignee: Alan Woodward
>         Attachments: SOLR-8323.patch, SOLR-8323.patch, SOLR-8323.patch, 
> SOLR-8323.patch
>
>
> An API to watch for changes to collection state would be a generally useful 
> thing, both internally and for client use.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to