ch.javasoft.job
Class CurrentThreadJobProcessor<R>
java.lang.Object
ch.javasoft.job.AbstractJobProcessor<R,R,Job<R>>
ch.javasoft.job.CurrentThreadJobProcessor<R>
- Type Parameters:
R - The final result returned by the job after successful
termination.
- All Implemented Interfaces:
- JobProcessor<R,R,Job<R>>
public class CurrentThreadJobProcessor<R>
- extends AbstractJobProcessor<R,R,Job<R>>
The CurrentThreadJobProcessor executes jobs synchroneously in the
current thread, i.e. both methods exec(Job) and
execAndWait(Job) behave alike and block until completion.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CurrentThreadJobProcessor
public CurrentThreadJobProcessor()
exec
public JobMonitor<R> exec(Job<R> job)
- Since executed in the current thread, this method blocks until completion
just like
execAndWait(Job).
- Parameters:
job - the job to execute
- Returns:
- the job status, which also allows access to the result
when execution completed
execAndWait
public JobResult<R> execAndWait(Job<R> job)
- Description copied from interface:
JobProcessor
- Usually executes the given job and waits for completion, corresponding to
Executable.execAndWait(). Note that the exact behaviour is up to
the implementor and might diverge from this general description.
- Specified by:
execAndWait in interface JobProcessor<R,R,Job<R>>- Overrides:
execAndWait in class AbstractJobProcessor<R,R,Job<R>>
- Parameters:
job - the job to execute
- Returns:
- the job result, giving access to the return value on success,
or to the exception if execution caused any.