ch.javasoft.job
Interface Executable<R>

Type Parameters:
R - The return value type of the result
All Known Implementing Classes:
AbstractJob, ExecJob, MultiJobExecutable, PipeJob

public interface Executable<R>

The Executable is like a Job, but the execution is not necessarily performed synchronous.
The exec() method does not wait until the job execution has completed, and thus an execution monitor object is returned.
The execAndWait() method blocks until completion and returns the result, which might also be an exception, thus a result object instead of the return value is returned.


Method Summary
 JobMonitor<R> exec()
          Executes and returns immediately, without waiting for completion.
 JobMonitor<R> exec(JobTerminationHandler<R> terminationHandler)
          Executes and returns immediately, without waiting for completion.
 JobResult<R> execAndWait()
          Executes and waits for completion.
 R execAndWaitThrowException()
          Executes and waits for completion.
 

Method Detail

exec

JobMonitor<R> exec()
Executes and returns immediately, without waiting for completion.

Returns:
the job monitor, which also allows access to the result when execution completed

exec

JobMonitor<R> exec(JobTerminationHandler<R> terminationHandler)
Executes and returns immediately, without waiting for completion. The submitted termination handler is notified upon normal or exceptional termination.

Parameters:
terminationHandler - the handler for normal and exceptional termination of this job
Returns:
the job monitor

execAndWait

JobResult<R> execAndWait()
                         throws InterruptedException
Executes and waits for completion.

Returns:
the job result, giving access to the return value on success, or to the exception if execution caused any.
Throws:
InterruptedException

execAndWaitThrowException

R execAndWaitThrowException()
                            throws InterruptedException,
                                   Throwable
Executes and waits for completion. The result is returned on normal termination, and an exception is thrown on abnormal (exceptional) termination.

Returns:
the result if termination is normal
Throws:
InterruptedException
Throwable