docs: private <T> T executeWithRetry(final Callable<ExecuteResult> task,
                                     InputStreamProcessor<T> processor) throws
              CouchException {
          int attempts = 10;
          CouchException lastException = null;
          while (attempts-- > 0) {
              ExecuteResult result = null;
              try {
                  result = task.call();
                  if (result.stream != null) {
                      // success - process the inputstream
                      try {
                          return processor.processStream(result.stream);
                      } catch (Exception e) {
                          // Error processing the input stream
                          if (attempts > 0) {
                              logger.log(Level.WARNING, "Received an exception during response " +
                                      "stream processing. A retry will be attempted.", e);
                          } else {
                              logger.log(Level.SEVERE, "Response stream processing failed, no " +
                                      "retries remaining.", e);
                              throw e;
                          }
                      } finally {
                          result.stream.close();
                      }
                  }
              } catch (Exception e) {
                  throw new CouchException("Unexpected exception", e, -1);
              }
              lastException = result.exception;
              if (result.fatal) {
                  // fatal exception - don't attempt any more retries
                  throw result.exception;
              }
          }
          throw lastException;
      }