Scheduling custom server tasks

i2 Analyze supports the development of custom tasks that the server executes on a user-defined schedule. A task is simply a Java class that implements a specific interface and performs a custom action when invoked.

This topic describes how to deploy a custom task that you or someone else already created. For information about how to develop a custom task, see the scheduled task example in i2 Analyze Developer Essentials.

Deploying a custom task

To deploy a custom task, the Java class (and any supporting classes) must be packaged in a .jar file. You must then copy this .jar file to the configuration part of the toolkit. Place it the WEB-INF/lib sub-folder of the opal-services fragment, in the toolkit/configuration/fragments folder.

Note: A new fragment specifically for custom tasks is also an option, provided that it is also added to the topology.xml file for the deployment.


In order for the i2 Analyze server to discover the custom task, entries that identify it must be present in one of the settings files. A typical location for these entries is the toolkit/configuration/fragments/opal-services/WEB-INF/classes/ file.

The new entries have two parts, in the following format:


Here, <TaskName> is a name that identifies a particular task instance; <ImplementationClass> is the fully qualified class name for the implementation of that task; and <CronExpression> is a cron schedule expression for when the task should run.

The format of the cron expression is:

<minute> <hour> <day-of-month> <month> <day-of-week>

For example, a cron expression of 0 0 * * * results in a task running at midnight every day. See the UNIX cron format documentation for more information.

The following settings define two different tasks that use two different classes, on two different schedules:

CustomTaskScheduler.MyTask1.Expression=0 0 * * *

CustomTaskScheduler.MyTask2.Expression=0 */4 * * *


When the .jar file is copied into the toolkit, and the file is updated with the custom task class name and the cron schedule, the task is ready for deployment to the i2 Analyze server.

To deploy the custom task to the i2 Analyze server, run setup -t deployLiberty to update the configuration with your changes. Then, to set up the task to run according to its defined schedule, run setup -t startLiberty.

Monitoring a custom task

The scheduler log stores information about the state of all configured tasks, including when a task was last run, when it will next run, whether it has failed, and so on.

The scheduler log can be found in the i2_Scheduler.log file, inside the i2 Analyze server.

Note: If a custom task is configured to use the scheduler tracer (IScheduledTaskObjects.getSchedulerTracer()) in its onStartup() method, then anything logged through that object is also written to the i2_Scheduler.log file.