class AsyncPeriodicTask extends LinkableBase<AsyncPeriodicTask> implements AsyncTask {

    private final long delay;
    private Runnable runnable;
    private long last;
    private boolean canceled;

    public AsyncPeriodicTask(long delay, Runnable runnable) {
        this(delay, delay, runnable);
    }

    public AsyncPeriodicTask(long initialDelay, long delay, Runnable runnable) {
        this.delay = delay;
        this.runnable = runnable;

        if (initialDelay > 0) {
            last = System.currentTimeMillis() + initialDelay;
        } else {
            last = System.currentTimeMillis() + delay;
        }
    }

    @Override
    public boolean isPeriodic() {
        return true;
    }

    @Override
    public int getPriority() {
        return MIN_PRIORITY;
    }

    public void cancel() {
        canceled = true;
    }

    public boolean isCancelled() {
        return canceled;
    }

    @Override
    public void run() {<FILL_FUNCTION_BODY>}

    public long getDelay() {
        return delay;
    }

    public void setRunnable(Runnable runnable) {
        this.runnable = runnable;
    }

    public void resetLast() {
        last = 0;
    }
}

        if (canceled)
            return;
        long now = System.currentTimeMillis();
        if (now > last) {
            last = now + delay;
            runnable.run();
        }
    
<methods>public non-sealed void <init>() ,public com.lealone.db.async.AsyncPeriodicTask getNext() ,public void setNext(com.lealone.db.async.AsyncPeriodicTask) <variables>public com.lealone.db.async.AsyncPeriodicTask next