2.17.2: 2011-06-17

net.sf.basedb.clients.jobagent
Class JobQueueChecker

java.lang.Object
  extended by java.util.TimerTask
      extended by net.sf.basedb.clients.jobagent.JobQueueChecker
All Implemented Interfaces:
Runnable

public class JobQueueChecker
extends TimerTask

This class is given the responsibility to check the job queue for jobs that are awaiting execution. Each agent has one instance of this class which is registered with the BASE core scheduler Application.getScheduler().

This object should be thread-safe since the scheduler creates a new thread each time the run() method is called.

Version:
2.0
Author:
nicklas
Last modified
$Date: 2010-08-13 10:50:27 +0200 (Fri, 13 Aug 2010) $

Field Summary
private  Agent agent
           
private  int agentVersionForJobQuery
          The job agent's version when the query was cached.
private  ItemQuery<Job> jobQuery
          Cached query for waiting jobs.
private static Logger log
          Log job agent events.
 
Constructor Summary
JobQueueChecker(Agent agent)
           
 
Method Summary
 boolean cancel()
           
private  void checkForJobs()
           
 void run()
           
 
Methods inherited from class java.util.TimerTask
scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final Logger log
Log job agent events.


agent

private final Agent agent

jobQuery

private ItemQuery<Job> jobQuery
Cached query for waiting jobs. Reloaded only when the job agent's version has changed. We cache the query since loading all users that are allowed to use the job agent is an expensive operation.


agentVersionForJobQuery

private int agentVersionForJobQuery
The job agent's version when the query was cached.

Constructor Detail

JobQueueChecker

public JobQueueChecker(Agent agent)
Method Detail

run

public void run()
Specified by:
run in interface Runnable
Specified by:
run in class TimerTask

cancel

public boolean cancel()
Overrides:
cancel in class TimerTask

checkForJobs

private void checkForJobs()

2.17.2: 2011-06-17