public class DxTimer extends Object
ScheduledExecutorService
.
Used one thread to process Runnable
tasks. There are two modes of operation, a single launch with delay time
in the millis and daily periodic work in LocalTime
. There is no guarantee of the exact launch time.Modifier and Type | Class and Description |
---|---|
static interface |
DxTimer.Cancellable
The result is triggered by the
DxTimer , used only to cancel the scheduled task. |
Modifier and Type | Method and Description |
---|---|
static DxTimer |
getInstance()
Lazy creation of a singleton instance
DxTimer |
DxTimer.Cancellable |
runDaily(Runnable action,
LocalTime localTime)
Run periodic
Runnable task that will start every day in LocalTime |
DxTimer.Cancellable |
runOnce(Runnable action,
long delayMillis)
Run one-time delayed
Runnable task |
public static DxTimer getInstance()
DxTimer
DxTimer
instancepublic DxTimer.Cancellable runOnce(Runnable action, long delayMillis)
Runnable
taskaction
- Runnable
taskdelayMillis
- delay time in millisCancellable
public DxTimer.Cancellable runDaily(Runnable action, LocalTime localTime)
Runnable
task that will start every day in LocalTime
action
- Runnable
tasklocalTime
- periodic daily invoke timeCancellable
Copyright © 2002–2025 Devexperts LLC. All rights reserved.