foxtrot
Class Job
java.lang.Object
foxtrot.Task
foxtrot.Job
- Direct Known Subclasses:
- FlushJob
public abstract class Job
- extends Task
A time-consuming task to be executed in the Worker Thread that does not throw checked exceptions.
Users must implement the run() method with the time-consuming code:
Job task = new Job()
{
public Object run()
{
long sum = 0;
for (int i = 0; i < 1000000; ++i)
{
sum += i;
}
return new Integer(sum);
}
};
RuntimeExceptions or Errors thrown by the run() method will be rethrown automatically by
Worker.post(Job) or ConcurrentWorker.post(Job).
- Version:
- $Revision: 259 $
- See Also:
Worker,
ConcurrentWorker
|
Constructor Summary |
Job()
|
|
Method Summary |
abstract Object |
run()
The method to implement with time-consuming code. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Job
public Job()
run
public abstract Object run()
- The method to implement with time-consuming code.
It should NOT be synchronized or synchronize on this Job instance, otherwise the AWT Event Dispatch Thread
cannot efficiently test when this Job is completed.
Overridden to remove the throws clause, so that users does not
have to catch unthrown exceptions.
- Specified by:
run in class Task
Copyright © 2011 KnowledgePlaza. All Rights Reserved.