Brightspot CMS Developer Guide

Schedule tasks


The com.psddev.dari.util.Task class includes the following schedule methods to start a task at a specified time and to run it in periodic intervals. Unlike the submit method that runs a task one time and stops it, the schedule methods run the task repeatedly until it is manually stopped with the Task Status tool.

  • schedule(double initialDelay) runs a task with a delayed start and without pause. The schedule method below runs the task one hour after it is started. If initialDelay is zero, then the task starts immediately.
public MigrationTask() {
    /* Run repeatedly with a delayed start */
    task.schedule(3600.0);
}

  • scheduleWithFixedDelay(double initialDelay, double periodicDelay) runs a task with a delayed start, with a periodic delay, and with a single execution of the task between delays. The scheduleWithFixedDelay method below starts the task immediately, executes the doTask method one time, delays execution for one hour, then repeats the execution-delay pattern.
public MigrationTask() {
    /* Run repeatedly, delaying for one hour after a single execution of the task */
    task.scheduleWithFixedDelay(0,3600.0);
}

  • scheduleAtFixedRate(double initialDelay, double periodicDelay) runs a task with a delayed start and with fixed execution and delay times. The scheduleAtFixedRate method below starts the task immediately, repeatedly executes doTask for one hour, delays execution for one hour, then repeats the execution-delay pattern.
public MigrationTask() {
    /* Run repeatedly with one-hour execution and delay periods */
    task.scheduleAtFixedRate(0,3600.0);
}

Previous Topic
Creating a background task
Next Topic
Repeating tasks
Was this topic helpful?
Thanks for your feedback.
Our robust, flexible Design System provides hundreds of pre-built components you can use to build the presentation layer of your dreams.

Asset types
Module types
Page types
Brightspot is packaged with content types that get you up and running in a matter of days, including assets, modules and landing pages.

Content types
Modules
Landing pages
Everything you need to know when creating, managing, and administering content within Brightspot CMS.

Dashboards
Publishing
Workflows
Admin configurations
A guide for installing, supporting, extending, modifying and administering code on the Brightspot platform.

Field types
Content modeling
Rich-text elements
Images
A guide to configuring Brightspot's library of integrations, including pre-built options and developer-configured extensions.

Google Analytics
Shopify
Apple News