Package sg.dex.starfish.impl.remote
Class RemoteJob
- java.lang.Object
-
- sg.dex.starfish.impl.remote.RemoteJob
-
-
Field Summary
-
Fields inherited from interface sg.dex.starfish.Job
MAX_TIMEOUT_MILLIS
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods 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 Detail
-
create
public static RemoteJob create(RemoteAgent agent2, String jobID)
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
public Map<String,Object> 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
public Map<String,Object> get(long timeout, TimeUnit timeUnit) throws TimeoutException
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
public String 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
public String 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
-
-