corda / com.r3.corda.networkmanage.common.utils / scheduleRetryingTask

scheduleRetryingTask

fun scheduleRetryingTask(taskDescription: String, taskExecutionInterval: Long, timeoutMillis: Long, ctx: <ERROR CLASS>, maxRetries: Int? = null, maxBackoffTimeMillis: Long? = null, task: () -> Unit): ExponentialBackOffTimer

Schedules a task to execute every taskExecutionInterval, with each failed execution using a retrying exponential backoff strategy. After a given execution has succeeded then the next execution (taskExecutionInterval after the first attempt) will continue as normal, regardless of the number of retries that the previous attempt had.

Parameters

taskDescription - A human readable description of the task to execute.

taskExecutionInterval - The period in millis between each task execution.

timeoutMillis - The millisecond timeout threshold for each execution of a task.

ctx - Logging context.

maxRetries - Optional integer value representing the maximum number of times that any given execution of a task should be retried before giving up (and waiting for the next scheduled execution).

maxBackoffTimeMillis - Optional millisecond value to cap the retry delay during exponential backoff.

task - The task to execute.