dk.netarkivet.harvester.scheduler
Class HarvestScheduler

java.lang.Object
  extended by dk.netarkivet.common.lifecycle.LifeCycleComponent
      extended by dk.netarkivet.harvester.scheduler.HarvestScheduler
All Implemented Interfaces:
ComponentLifeCycle

public class HarvestScheduler
extends LifeCycleComponent

This class handles dispatching of scheduled Harvest jobs to the Harvest servers.

The scheduler loads all active harvest definitions on a regular basis and extracts the scheduling information for each definition. When a harvest definition is scheduled to start the scheduler creates the corresponding harvest jobs and submits these to the active HarvestServers.

It also handles backup and makes sure backup is not performed while jobs are being scheduled.

Note: Only one HarvestScheduler should be running at a time.


Field Summary
protected static org.apache.commons.logging.Log log
          The logger to use.
 
Constructor Summary
HarvestScheduler()
          Create new instance of the HarvestScheduler.
 
Method Summary
(package private)  void dispatchJobs()
          Dispatched new jobs Stop jobs with status STARTED, which have been on running for more than settings.harvester.scheduler.jobtimeouttime time.
 void doOneCrawl(Job job, java.util.List<MetadataEntry> metadata)
          Submit an doOneCrawl request to a HarvestControllerServer with correct priority.
 void shutdown()
          Release allocated resources (JMS connections) and stops dispatching harvest jobs, all without logging.
 void start()
          Start the thread responsible for reading Harvest definitions from the database, and dispatching the harvest job to the servers.
(package private)  void submitNewJobs()
          Submit the next new job if the relevant message queue is empty.
 
Methods inherited from class dk.netarkivet.common.lifecycle.LifeCycleComponent
addChild
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.commons.logging.Log log
The logger to use.

Constructor Detail

HarvestScheduler

public HarvestScheduler()
Create new instance of the HarvestScheduler.

Method Detail

start

public void start()
Start the thread responsible for reading Harvest definitions from the database, and dispatching the harvest job to the servers.

Specified by:
start in interface ComponentLifeCycle
Overrides:
start in class LifeCycleComponent

dispatchJobs

void dispatchJobs()
Dispatched new jobs Stop jobs with status STARTED, which have been on running for more than settings.harvester.scheduler.jobtimeouttime time.


submitNewJobs

void submitNewJobs()
Submit the next new job if the relevant message queue is empty.


doOneCrawl

public void doOneCrawl(Job job,
                       java.util.List<MetadataEntry> metadata)
                throws ArgumentNotValid,
                       IOFailure
Submit an doOneCrawl request to a HarvestControllerServer with correct priority.

Parameters:
job - the specific job to send
metadata - pre-harvest metadata to store in arcfile.
Throws:
ArgumentNotValid - one of the parameters are null
IOFailure - if unable to send the doOneCrawl request to a harvestControllerServer

shutdown

public void shutdown()
Release allocated resources (JMS connections) and stops dispatching harvest jobs, all without logging.

Specified by:
shutdown in interface ComponentLifeCycle
Overrides:
shutdown in class LifeCycleComponent