org.ofbiz.service.job
Class JobPoller

java.lang.Object
  extended by org.ofbiz.service.job.JobPoller
All Implemented Interfaces:
java.lang.Runnable

public class JobPoller
extends java.lang.Object
implements java.lang.Runnable

JobPoller - Polls for persisted jobs to run.


Field Summary
protected  boolean isRunning
           
protected  JobManager jm
           
static int MAX_JOBS
           
static int MAX_THREADS
           
static int MIN_THREADS
           
static java.lang.String module
           
static int POLL_WAIT
           
protected  java.util.List<JobInvoker> pool
           
protected  java.util.List<Job> run
           
protected  java.lang.Thread thread
           
 
Constructor Summary
protected JobPoller()
           
  JobPoller(JobManager jm, boolean enabled)
          Creates a new JobScheduler
 
Method Summary
 JobManager getManager()
          Returns the JobManager
 java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getPoolState()
           
 void killThread(java.lang.String threadName)
           
 Job next()
          Returns the next job to run
 void queueNow(Job job)
          Adds a job to the RUN queue
 void removeThread(JobInvoker invoker)
          Removes a thread from the pool.
 void run()
           
 void stop()
          Stops the JobPoller
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

module

public static final java.lang.String module

MIN_THREADS

public static final int MIN_THREADS
See Also:
Constant Field Values

MAX_THREADS

public static final int MAX_THREADS
See Also:
Constant Field Values

MAX_JOBS

public static final int MAX_JOBS
See Also:
Constant Field Values

POLL_WAIT

public static final int POLL_WAIT
See Also:
Constant Field Values

thread

protected java.lang.Thread thread

pool

protected java.util.List<JobInvoker> pool

run

protected java.util.List<Job> run

jm

protected JobManager jm

isRunning

protected volatile boolean isRunning
Constructor Detail

JobPoller

public JobPoller(JobManager jm,
                 boolean enabled)
Creates a new JobScheduler

Parameters:
jm - JobManager associated with this scheduler

JobPoller

protected JobPoller()
Method Detail

run

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

getManager

public JobManager getManager()
Returns the JobManager


stop

public void stop()
Stops the JobPoller


getPoolState

public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getPoolState()

killThread

public void killThread(java.lang.String threadName)

next

public Job next()
Returns the next job to run


queueNow

public void queueNow(Job job)
Adds a job to the RUN queue


removeThread

public void removeThread(JobInvoker invoker)
Removes a thread from the pool.

Parameters:
invoker - The invoker to remove.