org.crosswire.common.progress
Class JobManager

java.lang.Object
  extended by org.crosswire.common.progress.JobManager

public class JobManager
extends Object

JobManager is responsible for creating jobs and informing listeners about the progress they make to completion.

Example code:

 final Thread worker = new Thread("DisplayPreLoader")
 {
     public void run()
     {
         URL predicturl = Project.instance().getWritablePropertiesURL("save-name");
         Job job = JobManager.createJob("Job Title", predicturl, this, true);
 
         try
         {
             job.setProgress("Step 1");
             ...
             job.setProgress("Step 2");
             ...
         }
         catch (Exception ex)
         {
             ...
             job.ignoreTimings();
         }
         finally
         {
             job.done();
         }
     }
 };
 
 worker.setPriority(Thread.MIN_PRIORITY);
 worker.start();
 

Distribution Licence:
JSword is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
The License is available on the internet here, or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
The copyright to this program is held by it's authors.

Version:
$Id: JobManager.java,v 1.4 2004/08/30 09:27:27 joe Exp $
Author:
Joe Walker [joe at eireneh dot com]
See Also:
Licence

Field Summary
private static Set jobs
          List of current jobs
private static List listeners
          List of listeners
private static Logger log
          The log stream
 
Constructor Summary
private JobManager()
          Prevent Instansiation
 
Method Summary
static void addWorkListener(WorkListener li)
          Add a listener to the list
static Job createJob(String description, boolean fakeupdates)
          Create a new Job
static Job createJob(String description, Thread work, boolean fakeupdates)
          Create a new Job
static Job createJob(String description, URL predicturl, boolean fakeupdates)
          Create a new Job
static Job createJob(String description, URL predicturl, Thread work, boolean fakeupdates)
          Create a new Job
protected static void fireWorkProgressed(Job job, boolean predicted)
          Inform the listeners that a title has changed.
static Set getJobs()
          Accessor for the currently known jobs
static void removeWorkListener(WorkListener li)
          Remote a listener from the list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

private static List listeners
List of listeners


jobs

private static Set jobs
List of current jobs


log

private static final Logger log
The log stream

Constructor Detail

JobManager

private JobManager()
Prevent Instansiation

Method Detail

createJob

public static Job createJob(String description,
                            URL predicturl,
                            Thread work,
                            boolean fakeupdates)
Create a new Job


createJob

public static Job createJob(String description,
                            Thread work,
                            boolean fakeupdates)
Create a new Job


createJob

public static Job createJob(String description,
                            URL predicturl,
                            boolean fakeupdates)
Create a new Job


createJob

public static Job createJob(String description,
                            boolean fakeupdates)
Create a new Job


addWorkListener

public static void addWorkListener(WorkListener li)
Add a listener to the list


removeWorkListener

public static void removeWorkListener(WorkListener li)
Remote a listener from the list


getJobs

public static Set getJobs()
Accessor for the currently known jobs


fireWorkProgressed

protected static void fireWorkProgressed(Job job,
                                         boolean predicted)
Inform the listeners that a title has changed.


Copyright ? 2003-2004