def run[A]()

in samza-core/src/main/scala/org/apache/samza/util/ExponentialSleepStrategy.scala [86:102]


  def run[A](loopOperation: RetryLoop => A, onException: (Exception, RetryLoop) => Unit): Option[A] = {
    val loop = startLoop
    while (!loop.isDone && !Thread.currentThread.isInterrupted) {
      try {
        val result = loopOperation(loop)
        if (loop.isDone) return Some(result)
      } catch {
        case e: InterruptedException       => throw e
        case e: ClosedByInterruptException => throw e
        case e: OutOfMemoryError           => throw e
        case e: StackOverflowError         => throw e
        case e: Exception                  => onException(e, loop)
      }
      if (!loop.isDone && !Thread.currentThread.isInterrupted) loop.sleep
    }
    None
  }