Skip to content

74. Task Scheduler

To support asynchronous task scheduling, SolarNode provides a Spring TaskScheduler service to plugins.

The Job Scheduler

For user-configurable scheduled tasks, check out the Job Scheduler service.

To make use of any of this service from a plugin using OSGi Blueprint you can declare a reference like this:

<reference id="taskScheduler" interface="org.springframework.scheduling.TaskScheduler"
        filter="(function=node)"/>

74.1 Configuration

The Task Scheduler supports the following configuration properties in the net.solarnetwork.node.core namespace:

Property Default Description
jobScheduler.poolSize 10 The number of threads to maintain in the job scheduler, and thus the maximum number of jobs that can run simultaneously. Must be set to 1 or higher.
scheduler.startupDelay 180 A delay in seconds after creating the job scheduler to start triggering jobs. This can be useful to give the application time to completely initialize before starting to run jobs.

For example, to change the thread pool size to 20 and shorten the startup delay to 30 seconds, create an /etc/solarnode/services/net.solarnetwork.node.core.cfg file with the following content:

jobScheduler.poolSize = 20
scheduler.startupDelay = 30