Foxtrot
Version 2.0

foxtrot
Class Job

java.lang.Object
  extended by foxtrot.Task
      extended by foxtrot.Job

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 job).

Version:
$Revision: 1 $
Author:
Simone Bordet
See Also:
Worker

Constructor Summary
Job()
           
 
Method Summary
abstract  Object run()
          The method to implement with time-consuming code.
 
Methods inherited from class foxtrot.Task
isCompleted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Job

public Job()
Method Detail

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
Returns:
the result of the task

Foxtrot
Version 2.0