Skip to content

Scheduled tasks

Marten edited this page Jul 6, 2013 · 1 revision

Geoportal Server has a built in task scheduling framework. Through this framework you can have specific tasks be started a certain times. These tasks may vary from ensuring the Lucene index and the database are in sync, optimizing the lucene index, to running arbitrary scripts on the server.

Intro

Gpt.xml includes a scheduler element with options to turn on/off the entire framework and control the number of threads. Within this element there are configurations of individual threads that specify:

  • class - the java class that executes the task in this thread
  • period - the frequency of running the tasks in this thread
  • delay - the time to wait from task finish to next start. only applies if the duration of the tasks exceeds the time between scheduled runs.
  • at - the time at which the task in this thread will run (mutually exclusive of period)

Catalog synchronization

This is an important task (especially in multi-server configurations) as it keeps the database and the lucene index in sync. The task is run using the class com.esri.gpt.catalog.context.CatalogSynchronizer.

Index optimization

This tasks optimizes the lucene index, which cleans up empty space and reindexes for better search performance. The task is run using the class com.esri.gpt.catalog.lucene.LuceneIndexOptimizer.

ScriptRunner

At version 1.2.4 we have added the generic com.esri.gpt.framework.scheduler.ScriptRunner task type. With this task type you can run essentially any script that is accessible to the web server where Geoportal Server is deployed.

This task is configured as follows:

<thread class="com.esri.gpt.framework.scheduler.ScriptRunner" at="01:00">
  <parameter key="script" value="/path/script.sh"/>
</thread>

The parameter element is a key/value configuration with in this case the script key defining the location of the script to run.

Clone this wiki locally