Class RetryOneTime

java.lang.Object
org.apache.curator.retry.RetryNTimes
org.apache.curator.retry.RetryOneTime
All Implemented Interfaces:
RetryPolicy

public class RetryOneTime
extends RetryNTimes
A retry policy that retries only once
  • Constructor Summary

    Constructors 
    Constructor Description
    RetryOneTime​(int sleepMsBetweenRetry)  
  • Method Summary

    Modifier and Type Method Description
    boolean allowRetry​(int retryCount, long elapsedTimeMs, RetrySleeper sleeper)
    Called when an operation has failed for some reason.
    int getN()  

    Methods inherited from class org.apache.curator.retry.RetryNTimes

    getSleepTimeMs

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.curator.RetryPolicy

    allowRetry
  • Constructor Details

    • RetryOneTime

      public RetryOneTime​(int sleepMsBetweenRetry)
  • Method Details

    • getN

      public int getN()
    • allowRetry

      public boolean allowRetry​(int retryCount, long elapsedTimeMs, RetrySleeper sleeper)
      Description copied from interface: RetryPolicy
      Called when an operation has failed for some reason. This method should return true to make another attempt.
      Specified by:
      allowRetry in interface RetryPolicy
      Parameters:
      retryCount - the number of times retried so far (0 the first time)
      elapsedTimeMs - the elapsed time in ms since the operation was attempted
      sleeper - use this to sleep - DO NOT call Thread.sleep
      Returns:
      true/false