Extensions for java.util.Timer

Platform and version requirements: JVM (1.0)

schedule

Schedules an action to be executed after the specified delay (expressed in milliseconds).

fun Timer.schedule(
    delay: Long, 
    action: TimerTask.() -> Unit
): TimerTask

Schedules an action to be executed at the specified time.

fun Timer.schedule(
    time: Date, 
    action: TimerTask.() -> Unit
): TimerTask

Schedules an action to be executed periodically, starting after the specified delay (expressed in milliseconds) and with the interval of period milliseconds between the end of the previous task and the start of the next one.

fun Timer.schedule(
    delay: Long, 
    period: Long, 
    action: TimerTask.() -> Unit
): TimerTask

Schedules an action to be executed periodically, starting at the specified time and with the interval of period milliseconds between the end of the previous task and the start of the next one.

fun Timer.schedule(
    time: Date, 
    period: Long, 
    action: TimerTask.() -> Unit
): TimerTask
Platform and version requirements: JVM (1.0)

scheduleAtFixedRate

Schedules an action to be executed periodically, starting after the specified delay (expressed in milliseconds) and with the interval of period milliseconds between the start of the previous task and the start of the next one.

fun Timer.scheduleAtFixedRate(
    delay: Long, 
    period: Long, 
    action: TimerTask.() -> Unit
): TimerTask

Schedules an action to be executed periodically, starting at the specified time and with the interval of period milliseconds between the start of the previous task and the start of the next one.

fun Timer.scheduleAtFixedRate(
    time: Date, 
    period: Long, 
    action: TimerTask.() -> Unit
): TimerTask

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.concurrent/java.util.-timer/index.html