public abstract class Job extends Task
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).Worker,
ConcurrentWorker| Constructor and Description |
|---|
Job() |
| Modifier and Type | Method and Description |
|---|---|
abstract Object |
run()
The method to implement with time-consuming code.
|
getResultOrThrow, isCompletedpublic abstract Object run()
Copyright © 2002-2011. All Rights Reserved.