uk.ac.ncl.cs.instantsoap.job.impl
Class JobManagerImpl

java.lang.Object
  extended by uk.ac.ncl.cs.instantsoap.job.impl.JobManagerImpl
All Implemented Interfaces:
JobManager

public class JobManagerImpl
extends Object
implements JobManager

Manage a set of jobs.

This implementation keeps jobs live for a maximum amount of time. It also will delete jobs within some maximum time that

Author:
Louis, Matthew Pocock

Constructor Summary
JobManagerImpl(JobFactory jobFactory, ScheduledExecutorService jobCleaner)
           
 
Method Summary
 Throwable getFailureReason(UUID uuid)
          Get the reason for failure for the job associated with the id.
 InvocationState getInvocationState(UUID uuid)
          Get the invocation state associated with the id.
 Date getJobExecutionEndTime(UUID uuid)
          Get the execution end time for the job associated with the id.
 Date getJobExecutionStartTime(UUID uuid)
          Get the submission time for the job associated with the id.
 Date getJobSubmissionTime(UUID uuid)
          Get the submission time for the job associated with the id.
 Map<String,String> getResult(UUID uuid)
          Get the results of the job associated with the id.
 boolean isFailure(UUID uuid)
          Return true if the job associated with the uuid has failed.
 UUID newJob()
          Create a new Job and return the corresponding UUID.
 void setFailure(UUID uuid, boolean failure)
          Update the failure status of the job with the id.
 void setFailureReason(UUID uuid, Throwable failureReason)
          Set the reason for failure for the job associated with the id.
 void setInvocationState(UUID uuid, InvocationState state)
          Set the invocation state associated with the id.
 void setJobExecutionEndTime(UUID uuid, Date time)
          Set the execution end time for the job associated with the id.
 void setJobExecutionStartTime(UUID uuid, Date time)
          Set the submission time for the job associated with the id.
 void setJobSubmissionTime(UUID uuid, Date time)
          Set the submission time for the job associated with the id.
 void setResult(UUID uuid, Map<String,String> result)
          Set the results of the job associated with the id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobManagerImpl

public JobManagerImpl(JobFactory jobFactory,
                      ScheduledExecutorService jobCleaner)
Method Detail

newJob

public UUID newJob()
Description copied from interface: JobManager
Create a new Job and return the corresponding UUID.

Specified by:
newJob in interface JobManager
Returns:
the UUID of the new job

isFailure

public boolean isFailure(UUID uuid)
Description copied from interface: JobManager
Return true if the job associated with the uuid has failed.

Specified by:
isFailure in interface JobManager
Parameters:
uuid - the UUID of the job to check
Returns:
the failure status of the job

setFailure

public void setFailure(UUID uuid,
                       boolean failure)
Description copied from interface: JobManager
Update the failure status of the job with the id.

Specified by:
setFailure in interface JobManager
Parameters:
uuid - the UUID identifying the job
failure - the new failure status of the job

setResult

public void setResult(UUID uuid,
                      Map<String,String> result)
               throws JobExecutionException
Description copied from interface: JobManager
Set the results of the job associated with the id.

Specified by:
setResult in interface JobManager
Parameters:
uuid - the UUID identifying the job
result - the Map containing the results
Throws:
JobExecutionException

getResult

public Map<String,String> getResult(UUID uuid)
                             throws JobExecutionException
Description copied from interface: JobManager
Get the results of the job associated with the id.

Specified by:
getResult in interface JobManager
Parameters:
uuid - the UUID identifying the job
Returns:
the Map of results
Throws:
JobExecutionException

getFailureReason

public Throwable getFailureReason(UUID uuid)
                           throws JobExecutionException
Description copied from interface: JobManager
Get the reason for failure for the job associated with the id.

Specified by:
getFailureReason in interface JobManager
Parameters:
uuid - the UUID identifying the job
Returns:
the reason for failure
Throws:
JobExecutionException

setFailureReason

public void setFailureReason(UUID uuid,
                             Throwable failureReason)
                      throws JobExecutionException
Description copied from interface: JobManager
Set the reason for failure for the job associated with the id.

Specified by:
setFailureReason in interface JobManager
Parameters:
uuid - the UUID identifying the job
failureReason - the Throwable that is the reason for failure
Throws:
JobExecutionException

getInvocationState

public InvocationState getInvocationState(UUID uuid)
Description copied from interface: JobManager
Get the invocation state associated with the id.

Specified by:
getInvocationState in interface JobManager
Parameters:
uuid - the UUID identifying the job
Returns:
the InvocationState

setInvocationState

public void setInvocationState(UUID uuid,
                               InvocationState state)
Description copied from interface: JobManager
Set the invocation state associated with the id.

Specified by:
setInvocationState in interface JobManager
Parameters:
uuid - the UUID identifying the job
state - the InvocationStatus

getJobSubmissionTime

public Date getJobSubmissionTime(UUID uuid)
Description copied from interface: JobManager
Get the submission time for the job associated with the id.

Specified by:
getJobSubmissionTime in interface JobManager
Parameters:
uuid - the UUID identifying the job
Returns:
the Date specifying the submission time

setJobSubmissionTime

public void setJobSubmissionTime(UUID uuid,
                                 Date time)
Description copied from interface: JobManager
Set the submission time for the job associated with the id.

Specified by:
setJobSubmissionTime in interface JobManager
Parameters:
uuid - the UUID identifying the job
time - the Date when the job was submited

getJobExecutionStartTime

public Date getJobExecutionStartTime(UUID uuid)
Description copied from interface: JobManager
Get the submission time for the job associated with the id.

Specified by:
getJobExecutionStartTime in interface JobManager
Parameters:
uuid - the UUID identifying the job
Returns:
the Date that the execution of the job started

setJobExecutionStartTime

public void setJobExecutionStartTime(UUID uuid,
                                     Date time)
Description copied from interface: JobManager
Set the submission time for the job associated with the id.

Specified by:
setJobExecutionStartTime in interface JobManager
Parameters:
uuid - the UUID identifying the job
time - the Date when the job started being executed

getJobExecutionEndTime

public Date getJobExecutionEndTime(UUID uuid)
Description copied from interface: JobManager
Get the execution end time for the job associated with the id.

Specified by:
getJobExecutionEndTime in interface JobManager
Parameters:
uuid - the UUID identifying the job
Returns:
the Date when the execution of the job ended

setJobExecutionEndTime

public void setJobExecutionEndTime(UUID uuid,
                                   Date time)
Description copied from interface: JobManager
Set the execution end time for the job associated with the id.

Specified by:
setJobExecutionEndTime in interface JobManager
Parameters:
uuid - the UUID identifying the job


Copyright © 2006-2008. All Rights Reserved.