dsmiley commented on a change in pull request #1437:
URL: https://github.com/apache/lucene-solr/pull/1437#discussion_r411609323



##########
File path: 
solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java
##########
@@ -398,6 +337,39 @@ public Map getZkJson(String path) throws KeeperException, 
InterruptedException {
       return 
Utils.getJson(zkClientClusterStateProvider.getZkStateReader().getZkClient(), 
path, true);
     }
 
+    /**
+     * Will attempt to call {@link #invoke(String, String, SolrParams)} up to 
five times, retrying on any IO Exceptions
+     */
+    public SimpleSolrResponse invokeWithRetry(String solrNode, String path, 
SolrParams params) throws InterruptedException, IOException, 
SolrServerException {
+      int retries = 5;
+      int cnt = 0;
+
+      while (cnt++ < retries) {
+        try {
+          return invoke(solrNode, path, params);
+        } catch (SolrException | SolrServerException | IOException e) {
+          boolean hasIOExceptionCause = false;
+
+          Throwable t = e;
+          while (t != null) {
+            if (t instanceof IOException) {
+              hasIOExceptionCause = true;
+              break;
+            }
+            t = t.getCause();
+          }
+
+          if (hasIOExceptionCause) {
+            log.info("Error on getting remote info, trying again: " + 
e.getMessage());

Review comment:
       I recommend {} and passing "e".  (note Erick's efforts lately to tame 
the loggers)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to