Extensions for java.util.Timer

schedule

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

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

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

Schedules an action to be executed at the specified time.

fun Timer.schedule(
    delay: Long,
    period: Long,
    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(
    time: Date,
    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.

scheduleAtFixedRate

fun Timer.scheduleAtFixedRate(
    delay: Long,
    period: Long,
    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 start of the previous task and the start of the next one.

fun Timer.scheduleAtFixedRate(
    time: Date,
    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.