org.apache.jetspeed.scheduler
Class JobQueue

java.lang.Object
  extended by org.apache.jetspeed.scheduler.JobQueue

public class JobQueue
extends Object

Queue for the scheduler.

Version:
$Id: JobQueue.java 516448 2007-03-09 16:25:47Z ate $
Author:
Dave Bryson

Field Summary
private  Vector queue
          The queue of JobEntry objects.
 
Constructor Summary
JobQueue()
          Creates a new instance.
 
Method Summary
 void add(JobEntry je)
          Add a job to the queue.
 void batchLoad(List jobEntries)
          Batch load jobs.
 JobEntry getJob(JobEntry je)
          Return a specific job.
 JobEntry getNext()
          Return the next job off the top of the queue, or null if there are no jobs in the queue.
 Vector list()
          List jobs in the queue.
 void modify(JobEntry je)
          Modify a job on the queue.
 void remove(JobEntry je)
          Remove a job from the queue.
private  void sortQueue()
          Re-sort the existing queue.
 void updateQueue(JobEntry je)
          Update the job for its next run time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

queue

private Vector queue
The queue of JobEntry objects.

Constructor Detail

JobQueue

public JobQueue()
         throws Exception
Creates a new instance.

Throws:
Exception - A generic exception.
Method Detail

getNext

public JobEntry getNext()
Return the next job off the top of the queue, or null if there are no jobs in the queue.

Returns:
The next job in the queue.

getJob

public JobEntry getJob(JobEntry je)
Return a specific job.

Parameters:
je - The JobEntry we are looking for.
Returns:
A JobEntry.

list

public Vector list()
List jobs in the queue. This is used by the scheduler UI.

Returns:
A Vector of JobEntry objects.

add

public void add(JobEntry je)
Add a job to the queue.

Parameters:
je - A JobEntry job.

batchLoad

public void batchLoad(List jobEntries)
Batch load jobs. Retains any already enqueued jobs. Called on SchedulerService start-up.

Parameters:
jobEntries - A list of the JobEntry objects to load.

remove

public void remove(JobEntry je)
Remove a job from the queue.

Parameters:
je - A JobEntry with the job to remove.

modify

public void modify(JobEntry je)
Modify a job on the queue.

Parameters:
je - A JobEntry with the job to modify

updateQueue

public void updateQueue(JobEntry je)
                 throws Exception
Update the job for its next run time.

Parameters:
je - A JobEntry to be updated.
Throws:
Exception, - a generic exception.
Exception

sortQueue

private void sortQueue()
Re-sort the existing queue. Consumers of this method should be synchronized.



Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.