ch.javasoft.job
Interface JobMonitor<R>

Type Parameters:
R - The return value type of the result
All Known Implementing Classes:
ExecJobMonitor

public interface JobMonitor<R>

The JobMonitor allows monitoring of a Job currently being executed. Once the job has terminated, the result can be accessed by getJobResult(). Extensions of JobMonitor might offer further methods being specific for certain job types (e.g. ExecJobMonitor for ExecJobs).


Method Summary
 JobResult<R> getJobResult()
           
 void interrupt()
          Interrupts the process or thread, or does nothing if isRunning() returns false.
 boolean isRunning()
           
 JobResult<R> waitForResult()
          Blocks the current thread until the result is available.
 

Method Detail

isRunning

boolean isRunning()
Returns:
true if still processing, false if terminated (with or without exception)

getJobResult

JobResult<R> getJobResult()
Returns:
the result, or null if isRunning() returns true

waitForResult

JobResult<R> waitForResult()
                           throws InterruptedException
Blocks the current thread until the result is available.

Returns:
the result
Throws:
InterruptedException - if execution has been interrupted, e.g. by calling interrupt()

interrupt

void interrupt()
Interrupts the process or thread, or does nothing if isRunning() returns false. The waitForResult() method receives an InterruptedException if the job status is affected by this call.