|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.jfree.report.util.Worker
public final class Worker
A simple worker implementation. The worker executes a assigned workload and then sleeps until another workload is set or the worker is killed.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
Worker()
Creates a new worker. |
Method Summary | |
---|---|
void |
finish()
Kills the worker after he completed his work. |
WorkerPool |
getWorkerPool()
Returns the worker's assigned pool. |
java.lang.Runnable |
getWorkload()
Returns the workload object. |
boolean |
isAvailable()
Checks, whether this worker has some work to do. |
boolean |
isFinish()
Checks whether this worker has received the signal to finish and die. |
void |
run()
If a workload is set, process it. |
void |
setWorkerPool(WorkerPool workerPool)
Defines the worker's assigned pool. |
void |
setWorkload(java.lang.Runnable r)
Set the next workload for this worker. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Worker()
Method Detail |
---|
public void setWorkload(java.lang.Runnable r)
r
- the next workload for the worker.
java.lang.IllegalStateException
- if the worker is not idle.public java.lang.Runnable getWorkload()
public void finish()
public boolean isAvailable()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public boolean isFinish()
public WorkerPool getWorkerPool()
public void setWorkerPool(WorkerPool workerPool)
workerPool
- the worker pool (or null, if the worker is not assigned to a
pool).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |