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

ExponentialBackOffTimer

class ExponentialBackOffTimer : Timer

Extension of the Java Timer util class that schedules tasks with exponential backoff, as well as the ability to cancel the currently running task as well as future scheduled tasks. It also enables asynchronous cancellation

Creation of the timer is facilitated via the scheduleAndRun method

Constructors

<init>

ExponentialBackOffTimer(ctx: <ERROR CLASS>)

Extension of the Java Timer util class that schedules tasks with exponential backoff, as well as the ability to cancel the currently running task as well as future scheduled tasks. It also enables asynchronous cancellation

Properties

ctx

val ctx: <ERROR CLASS>

Functions

cancel

fun cancel(): Unit

Terminates this timer, discarding any currently scheduled tasks, as well as cancelling the currently executing task. This blocks until the timer and any executing tasks are cancelled, as opposed to the asynchronous version cancelAsync

cancelAsync

fun cancelAsync(): CompletableFuture<*>

Returns a future for the termination of this timer

Companion Object Functions

scheduleAndRun

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