code: public void run() throws Exception {
          // Send the initial command:
          client.sendRequest(cmd);
  
          long endTime = System.currentTimeMillis() + spec.getMaxDuration();
  
          // Wait until the 'after' time
          Thread.sleep(spec.getAfter());
  
          int numAttempts = 0;
          long now = System.currentTimeMillis();
  
          while (now < endTime) {
              client.sendRequest(cmd);
              now = System.currentTimeMillis();
  
              numAttempts ++;
  
              // See how to retry:
              long sleepTime = 0;
              if (spec.isConstant()) {
                  sleepTime = spec.getInterval();
              } else if (spec.isLinear()) {
                  sleepTime = spec.getInterval() * numAttempts;
              } else if (spec.isExponential()) {
                  sleepTime = (long) Math.pow(spec.getInterval(), numAttempts);
              }
  
              if (spec.getCeil() > 0) {
                  sleepTime = Math.min(spec.getCeil(), sleepTime);
              }
  
              if (now + sleepTime > endTime) {
                  break;
              } else {
                  accuSleep(sleepTime);
                  now = System.currentTimeMillis();
              }
          }
      }
docs: Runs until the retry duration is reached
  
  @throws Exception if an error occurs