Class Job

java.lang.Object
overit.geocall.scheduler.Job
All Implemented Interfaces:
overit.geocall.marks.FieldExposer

public class Job extends Object implements overit.geocall.marks.FieldExposer
This class defines a Job, how frequently this Bob will be executed, which task will be launched and the associated user.
  • Field Details

    • LOG

      protected static final LogChannel LOG
    • STATE_ACTIVE

      public static final int STATE_ACTIVE
      See Also:
    • STATE_INACTIVE

      public static final int STATE_INACTIVE
      See Also:
    • SINGLE_TIME

      public static final int SINGLE_TIME
      See Also:
    • EVERY_TIME

      public static final int EVERY_TIME
      See Also:
    • ERROR_SAVING_JOB_RUN_DATA

      protected static final String ERROR_SAVING_JOB_RUN_DATA
      See Also:
    • _running

      protected boolean _running
    • _sem

      protected final Object _sem
    • _jq

      protected JobQueue _jq
    • _id

      protected String _id
    • _mode

      protected int _mode
    • _description

      protected String _description
    • _state

      protected int _state
    • _lastEnd

      protected Date _lastEnd
    • _lastBegin

      protected Date _lastBegin
    • identity

      protected Identity identity
  • Constructor Details

  • Method Details

    • getMode

      public int getMode()
      Returns the mode of the job
      Returns:
      The mode of the job
    • getName

      public String getName()
      Returns the name of the job as it has been configured into the Company configuration
      Returns:
      The name of the job as it has been configured into the Company configuration
    • getState

      public int getState()
      Returns the state of the job
      Returns:
      The state of the job
    • getDescription

      public String getDescription()
      Returns the description of the job
      Returns:
      The description of the job
    • getId

      public String getId()
      Returns the id of the job
      Returns:
      The id of the job
    • activate

      public void activate()
      Activate the job
    • deactivate

      public void deactivate()
      Deactivate the job
    • cancel

      public void cancel()
      Cancel the job
    • enqueue

      public void enqueue(JobQueue jq, String description)
      Enqueue the job
      Parameters:
      jq - The JobQueue
      description - The description
    • getLastBegin

      public Date getLastBegin()
      Returns the last begin of the job
      Returns:
      The last begin of the job
    • getLastEnd

      public Date getLastEnd()
      Returns the last end of the job
      Returns:
      The last end of the job
    • getRunnable

      public Runnable getRunnable()
      Returns the Runnable of the job
      Returns:
      The Runnable of the job
    • getQueue

      public JobQueue getQueue()
      Returns the JobQueue
      Returns:
      The JobQueue
    • isRunning

      public boolean isRunning()
      Returns true if the job is running, false otherwise
      Returns:
      true if the job is running, false otherwise
    • getIdentity

      public Identity getIdentity()
      Return the Identity related to the configured Job
      Returns:
      the instance of the Identity
    • run

      public void run()
      Runs the job
    • run

      public void run(JobExecution jobExecution, Identity submitter)
      Runs the job
      Parameters:
      jobExecution - instance that trace the job running state
      submitter - the user that has manually launched the job (null if it has been launched by a queue)
    • runNow

      public void runNow(Identity submitter)
      Runs immediately the getRunnable() associated to this Job.
      Parameters:
      submitter - the identity that explicitly run the job. It may be null if the execution has been triggered by a queue
    • runNow

      public void runNow(JobExecution jobExecution, boolean reExecuteJobExecution, Identity submitter)
      Runs immediately the getRunnable() associated to this Job.
      Parameters:
      jobExecution - JobExecution about the task to run now.
      reExecuteJobExecution - if true, an already executed JobExecution has to be run another time; if false, a new JobExecution, never run before, has to be run.
      submitter - the identity that explicitly run the job. It may be null if the execution has been triggered by a queue
    • interrupt

      public void interrupt()
      Interrupt the job synchronously
    • asyncInterrupt

      public void asyncInterrupt()
      Interrupt the job asynchronously
    • handleShutdown

      public void handleShutdown()
      Handles the shutdown of the job by updating the job execution in the database This method should be called when the application is shutting down and the job is still running