|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectlt.monarch.print.JobProcessor
public class JobProcessor extends java.lang.Object implements java.lang.Runnable
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
jobListEmpty
Indicated whether job list is empty. |
protected java.util.ArrayList<java.lang.Runnable> |
jobs
Jobs list. |
protected java.lang.Thread |
processor
Job processor thread. |
protected boolean |
stopProcessing
Flag for stopping job processor. |
| Constructor and Description |
|---|
JobProcessor()
Creates new job processor with name "JobProcessor" and minimal thread priority. |
JobProcessor(java.lang.String name)
Creates new job processor with specified name. |
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Aborts the the job processor current job and removes all jobs from processor's jobs list. |
void |
add(java.lang.Runnable job)
Adds new job to jobs list. |
void |
addAndWait(java.lang.Runnable job)
Adds new job to the jobs list. |
void |
addAndWait(java.lang.Runnable job,
long timeout)
Adds new job to jobs list with timeout value for it's processing. |
static JobProcessor |
defaultProcessor()
Creates default job processor if there is no such already running. |
void |
interruptAndAbort()
Interrupts and aborts the job processor. |
protected void |
processJob(java.lang.Runnable job)
Processes specified job. |
void |
run()
Starts the job processor. |
void |
shutdown()
Shuts down the job processor. |
void |
waitForAll()
Waits until other processors are done processing job lists. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final java.util.ArrayList<java.lang.Runnable> jobs
protected java.lang.Thread processor
protected volatile boolean jobListEmpty
protected volatile boolean stopProcessing
| Constructor Detail |
|---|
public JobProcessor()
public JobProcessor(java.lang.String name)
name - name of new job processor.| Method Detail |
|---|
public static JobProcessor defaultProcessor()
public void add(java.lang.Runnable job)
job - job to be added add to the jobs list.
public void addAndWait(java.lang.Runnable job)
throws java.lang.InterruptedException
job - job to be added.java.lang.InterruptedException - when job is waiting in the jobs
list and other thread interrupts it.
public void addAndWait(java.lang.Runnable job,
long timeout)
throws java.lang.InterruptedException
job - job to be added to jobs list.timeout - timeout value of job processing (job processing is delayed for timeout milliseconds).java.lang.InterruptedException - when job is waiting in the jobs
list and other thread interrupts it.public void interruptAndAbort()
public void abort()
throws java.lang.InterruptedException
java.lang.InterruptedException - if job processor is interrupted while it waits.
public void shutdown()
throws java.lang.InterruptedException
java.lang.InterruptedException - if job processor is interrupted while it waits.
public void waitForAll()
throws java.lang.InterruptedException
java.lang.InterruptedException - if job processor is interrupted while it waits.public void run()
run in interface java.lang.Runnableprotected void processJob(java.lang.Runnable job)
job - job to process.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||