com.raritantechnologies.searchApp.scheduler
Class Scheduler

java.lang.Object
  extended byjava.lang.Thread
      extended bycom.raritantechnologies.searchApp.scheduler.Scheduler
All Implemented Interfaces:
IConfigurable, java.lang.Runnable

public class Scheduler
extends java.lang.Thread
implements IConfigurable

Scheduler manages a set of Configurable Jobs. Scheduler is owned by the ConfigurationManager.

At some interval, polls its Job's JobSchedule objects if they are ready to be processed. if so, the Job's IJobProcess is obtained and added to the QueueManager which handles Job dispatching.

Jobs are processed by JobDispatchers which take the IJobProcess and execute its executeJob( ).

XML Configuration Template:
 <Scheduler
     pollingInterval="10000"
     queueLimit="10"
     numDispatchers="2" >

   <Jobs>
    <Job>
      <JobSchedule schedulerClass="com.raritantechnologies.searchApp.scheduler.SimpleJobSchedule"
                      jobInterval="100000" >
        <!-- more complex schedulers would put their parameters here... -->
      </JobSchedule>

      <JobProcess processClass="com.raritantechnologies.searchApp.scheduler.JobProcessTester"
                      message="This is a test of the scheduler system." >
        <!-- initialization parameters for the IJobProcess object -->
      </JobProcess>

    </Job>
   </Jobs>
 </Scheduler>
 

Developed by Raritan Technologies .

Author:
Ted Sullivan

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Scheduler()
           
Scheduler(int queueLimit, int nDispatchers, int pollingInterval)
           
 
Method Summary
 void addJob(Job aJob)
          Add a job to the Scheduler queue.
 java.util.List getJobs()
           
 QueueManager getQueueManager()
           
 void initialize(org.w3c.dom.Element elem)
          Initializes the object from an XML tag or element.
static void main(java.lang.String[] args)
           
static long parseInterval(java.lang.String pollingIvlSt, long defaultIvl)
           
 void resumeJobs()
           
 void run()
           
 void setArgs(java.lang.String[] args)
           
 void start()
           
 void stopIt()
           
 void suspendJobs()
           
 void updateScheduleList(java.lang.String id, int status)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Scheduler

public Scheduler()

Scheduler

public Scheduler(int queueLimit,
                 int nDispatchers,
                 int pollingInterval)
Method Detail

setArgs

public void setArgs(java.lang.String[] args)

initialize

public void initialize(org.w3c.dom.Element elem)
Description copied from interface: IConfigurable
Initializes the object from an XML tag or element. This method is called by the Framework as part of the application initializtion. see ConfigurationManager, XMLConfigurationManager, XMLSearchFieldMapFactory, XMLSearchSourceFactory. Configurable objects that are owned or contained by other configurable objects will be initialized in by the parent object.

Specified by:
initialize in interface IConfigurable

start

public void start()

stopIt

public void stopIt()

suspendJobs

public void suspendJobs()

resumeJobs

public void resumeJobs()

run

public void run()
Specified by:
run in interface java.lang.Runnable

parseInterval

public static long parseInterval(java.lang.String pollingIvlSt,
                                 long defaultIvl)

addJob

public void addJob(Job aJob)
Add a job to the Scheduler queue.


getJobs

public java.util.List getJobs()

getQueueManager

public QueueManager getQueueManager()

main

public static void main(java.lang.String[] args)

updateScheduleList

public void updateScheduleList(java.lang.String id,
                               int status)