Package sg.dex.starfish.impl.remote
Class RemoteJob
java.lang.Object
sg.dex.starfish.impl.remote.RemoteJob
public class RemoteJob extends Object implements Job
This class represents a remote Job executed via the Invoke API on a remote agent.
-
Field Summary
-
Method Summary
Modifier and Type Method Description static RemoteJob
create(RemoteAgent agent2, String jobID)
Creates a RemoteJob representing a Job on a given RemoteAgent.Map<String,Object>
get(long timeout, TimeUnit timeUnit)
Waits for the result of the Operation and returns the result map.String
getJobID()
Gets the Job ID associated with this Job.String
getStatus()
Gets the status of the Job associated with this Operation.boolean
isDone()
Returns true if the Job has been completed, either due to success, failure or cancellation.Map<String,Object>
pollResult()
Polls the invokable service job for a complete result.
-
Method Details
-
create
Creates a RemoteJob representing a Job on a given RemoteAgent.Does not perform any validation on the existence of the Job
- Parameters:
agent2
-jobID
-- Returns:
-
isDone
public boolean isDone()Description copied from interface:Job
Returns true if the Job has been completed, either due to success, failure or cancellation.If the job has succeeded, the result may be obtained via get() or getResult()
-
pollResult
Polls the invokable service job for a complete result.Returns null if the Job has not completed, or if the remote service cannot be accessed
- Specified by:
pollResult
in interfaceJob
- Returns:
- The Map of
where key will be the result and value will be the payload - Throws:
JobFailedException
- If the job has failed
-
get
Description copied from interface:Job
Waits for the result of the Operation and returns the result map.Throws an exception if: - the timeout in milliseconds expires before the asset is available. - The Job fails or is cancelled
A timeout will not prevent the Job from completing at a later time.
-
getStatus
Description copied from interface:Job
Gets the status of the Job associated with this Operation. As mentioned in DEP6 ,the status of job can be: scheduled ,running,succeeded,failed,unknown -
getJobID
Description copied from interface:Job
Gets the Job ID associated with this Job. Job IDs are allocated by the agent implementation responsible for completing the job, and may be used to refer to the Job via other mechanisms.The definition of a Job ID is Agent-specific
-