title: How to make manual retry thread safe
body: <p>I am trying to do a manual retry. But I feel the code is not thread safe.
  Can anyone please provide suggestion on how to make it thread safe     </p>
  
  <pre><code>while (retryCounter &lt; maxRetries) {
            try {
              //TODO - add delay with config
              Thread.sleep(3000);
              t.run();
              break;
            } catch (Exception e) {
              retryCounter++;
              //TODO - Add audit logs
              if (retryCounter &gt;= maxRetries) {
                LOG.info("Max retries exceeded");
                //TODO - remove exception add audit logs
                throw new RuntimeException("Max retry exceeded");
              }
            }
          }
  </code></pre>
  
  <p>Thanks in advance</p>