Class RestJob

java.lang.Object
net.simplace.sim.wrapper.rest.job.RestJob

public class RestJob extends Object
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.
  • Constructor Details

    • RestJob

      public RestJob(String id)
      Creates a job in state PENDING.
      Parameters:
      id - job id
  • Method Details

    • getId

      public String getId()
      Returns:
      the job id (session id + ":" + UUID)
    • getCreatedAt

      public Instant getCreatedAt()
      Returns:
      the creation time
    • getStatus

      public RestJob.Status getStatus()
      Returns:
      the current state
    • getPercentage

      public int getPercentage()
      Returns:
      the progress in percent (0..100)
    • getErrorMessage

      public String 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

      public void markFailed(String aMessage)
      Marks the job as FAILED.
      Parameters:
      aMessage - error message