|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.crosswire.common.progress.JobManager
public final class JobManager
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 predictURI = Project.instance().getWritablePropertiesURI("save-name");
Progress job = JobManager.createJob("Job Title", predictURI, 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();
for license details.
The copyright to this program is held by it's authors.| Field Summary | |
|---|---|
private static Set<Progress> |
jobs
List of current jobs |
private static List<WorkListener> |
listeners
List of listeners |
private static org.slf4j.Logger |
log
The log stream |
| Constructor Summary | |
|---|---|
private |
JobManager()
Prevent instantiation |
| Method Summary | |
|---|---|
static void |
addWorkListener(WorkListener li)
Add a listener to the list |
static Progress |
createJob(String jobName)
Create a new Job that cannot be canceled. |
static Progress |
createJob(String jobName,
Thread workerThread)
Create a new Job that can be canceled. |
protected static void |
fireWorkProgressed(Progress job)
Inform the listeners that a title has changed. |
static Set<Progress> |
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 |
|---|
private static List<WorkListener> listeners
private static Set<Progress> jobs
private static final org.slf4j.Logger log
| Constructor Detail |
|---|
private JobManager()
| Method Detail |
|---|
public static Progress createJob(String jobName)
jobName - the name of the Job
public static Progress createJob(String jobName,
Thread workerThread)
jobName - the name of the JobworkerThread - the thread on which this job runspublic static void addWorkListener(WorkListener li)
public static void removeWorkListener(WorkListener li)
public static Set<Progress> getJobs()
protected static void fireWorkProgressed(Progress job)
|
Copyright ? 2003-2011 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||