com.virtuosotechnologies.lib.asyncjob
Interface AsyncJobExecution

All Known Implementing Classes:
AbstractAsyncJobRunner.ExecutionImpl

public interface AsyncJobExecution

An object that tracks an execution of a single AsyncJob.


Method Summary
 void addAsyncJobListener(AsyncJobListener listener)
          Add an execution listener.
 AsyncJob getAsyncJob()
          Get the job being run
 AsyncJobRunner getAsyncJobRunner()
          Get the runner running this job
 AsyncJobException getException()
          Get the job failure exception.
 Object getResult()
          Get the job result value.
 boolean isFinished()
          Has the job finished yet?
 boolean isStarted()
          Has the job started yet?
 void removeAsyncJobListener(AsyncJobListener listener)
          Remove an execution listener.
 boolean waitForCompletion()
          Wait until the job is finished.
 

Method Detail

getAsyncJobRunner

public AsyncJobRunner getAsyncJobRunner()
Get the runner running this job

Returns:
the AsyncJobRunner

getAsyncJob

public AsyncJob getAsyncJob()
Get the job being run

Returns:
the AsyncJob

waitForCompletion

public boolean waitForCompletion()
                          throws InterruptedException
Wait until the job is finished.

Returns:
true if the job succeeded, false if it failed
Throws:
InterruptedException

isStarted

public boolean isStarted()
Has the job started yet?

Returns:
true if the job has started

isFinished

public boolean isFinished()
Has the job finished yet?

Returns:
true if the job has finished

getResult

public Object getResult()
Get the job result value.

Returns:
the result value (which may be null) or null if the job is not finished or failed.

getException

public AsyncJobException getException()
Get the job failure exception.

Returns:
the exception with which the job failed, or null if the job is not finished or did not fail.

addAsyncJobListener

public void addAsyncJobListener(AsyncJobListener listener)
Add an execution listener.

Parameters:
listener - listener to add

removeAsyncJobListener

public void removeAsyncJobListener(AsyncJobListener listener)
Remove an execution listener.

Parameters:
listener - listener to remove