Package overit.geocall.scheduler
Class Job
java.lang.Object
overit.geocall.scheduler.Job
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Stringprotected JobQueueprotected Dateprotected Dateprotected intprotected booleanprotected final Objectprotected intprotected static final Stringstatic final intprotected Identityprotected static final LogChannelstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Activate the jobvoidInterrupt the job asynchronouslyvoidcancel()Cancel the jobvoidDeactivate the jobvoidEnqueue the jobReturns the description of the jobgetId()Returns the id of the jobReturn the Identity related to the configured JobReturns the last begin of the jobReturns the last end of the jobintgetMode()Returns the mode of the jobgetName()Returns the name of the job as it has been configured into the Company configurationgetQueue()Returns theJobQueueReturns theRunnableof the jobintgetState()Returns the state of the jobvoidHandles 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 runningvoidInterrupt the job synchronouslybooleanReturnstrueif the job is running,falseotherwisevoidrun()Runs the jobvoidrun(JobExecution jobExecution, Identity submitter) Runs the jobvoidrunNow(JobExecution jobExecution, boolean reExecuteJobExecution, Identity submitter) Runs immediately thegetRunnable()associated to thisJob.voidRuns immediately thegetRunnable()associated to thisJob.
-
Field Details
-
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
- See Also:
-
_running
protected boolean _running -
_sem
-
_jq
-
_id
-
_mode
protected int _mode -
_description
-
_state
protected int _state -
_lastEnd
-
_lastBegin
-
identity
-
-
Constructor Details
-
Job
Deprecated.- Parameters:
r- useJob(java.lang.Runnable, overit.geocall.util.Identity, int)mode- useJob(java.lang.Runnable, overit.geocall.util.Identity, int)
-
Job
Creates a new Job -
Job
Creates a new Job
-
-
Method Details
-
getMode
public int getMode()Returns the mode of the job- Returns:
- The mode of the job
-
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
Returns the description of the job- Returns:
- The description of the job
-
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
Enqueue the job- Parameters:
jq- TheJobQueuedescription- The description
-
getLastBegin
Returns the last begin of the job- Returns:
- The last begin of the job
-
getLastEnd
Returns the last end of the job- Returns:
- The last end of the job
-
getRunnable
Returns theRunnableof the job- Returns:
- The
Runnableof the job
-
getQueue
Returns theJobQueue- Returns:
- The
JobQueue
-
isRunning
public boolean isRunning()Returnstrueif the job is running,falseotherwise- Returns:
trueif the job is running,falseotherwise
-
getIdentity
Return the Identity related to the configured Job- Returns:
- the instance of the Identity
-
run
public void run()Runs the job -
run
Runs the job- Parameters:
jobExecution- instance that trace the job running statesubmitter- the user that has manually launched the job (null if it has been launched by a queue)
-
runNow
Runs immediately thegetRunnable()associated to thisJob.- Parameters:
submitter- the identity that explicitly run the job. It may be null if the execution has been triggered by a queue
-
runNow
Runs immediately thegetRunnable()associated to thisJob.- Parameters:
jobExecution-JobExecutionabout the task to run now.reExecuteJobExecution- iftrue, an already executedJobExecutionhas to be run another time; iffalse, a newJobExecution, 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
-
Job(java.lang.Runnable, overit.geocall.util.Identity, int)