Class RestJob
java.lang.Object
net.simplace.sim.wrapper.rest.job.RestJob
State of an asynchronously running /run call. A job belongs to exactly one session; the actual
simulation result is still available via SimplaceWrapper#getResult(...) as soon as the job is
DONE - this object only holds status, progress and error, not the result itself.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetId()intvoidmarkDone()Marks the job as DONE and sets the progress to 100 %.voidmarkFailed(String aMessage) Marks the job as FAILED.voidMarks the job as RUNNING.voidupdatePercentage(int aPercentage) Sets the progress.
-
Constructor Details
-
RestJob
-
-
Method Details
-
getId
- Returns:
- the job id (session id + ":" + UUID)
-
getCreatedAt
- Returns:
- the creation time
-
getStatus
- Returns:
- the current state
-
getPercentage
public int getPercentage()- Returns:
- the progress in percent (0..100)
-
getErrorMessage
- Returns:
- the error message, or null if the job has not failed
-
markRunning
public void markRunning()Marks the job as RUNNING. -
updatePercentage
public void updatePercentage(int aPercentage) Sets the progress.- Parameters:
aPercentage- progress in percent; limited to 0..100
-
markDone
public void markDone()Marks the job as DONE and sets the progress to 100 %. A job that has already FAILED (e.g. a simulation errored during the run, see JobProgressListener) stays FAILED with its error message. -
markFailed
Marks the job as FAILED.- Parameters:
aMessage- error message
-