code: public int ifRetriableWaitElseThrow(String msg, int retriesLeft, Logger logger)
      {
          if (this.isRetriable() && --retriesLeft > 0)
          {
              logger.warn(msg+ " " + this.getMessage());
              if (logger.isDebugEnabled())
              {
                  logger.debug("find failed with retriable error. retrying.", this);
              }
              cleanupAndRecreateTempContexts();
              this.waitBeforeRetrying();
          }
          else throw this;
          return retriesLeft;
      }
docs: must not be called from within a transaction, unless the work is being done async in a non-tx thread.