Interface JobExecutor
- All Known Implementing Classes:
DummyJobExecutor
,ProcessJobExecutor
,ThreadJobExecutor
agent.executor.class
configuration setting.
Each agent only has one instance of a job executor, which means
that a job executor must be thread-safe and able to execute more than
one job at a time. It is not a good solution to put the synchonrized
keyword on the executeJob(SessionControl, Agent, Job, JobAgentSettings, Job.ExecutionTime)
method since it would limit the execution to one job at a time.
A job executor must provide a public no-argument constructor.
- Version:
- 2.0
- Author:
- nicklas
- Last modified
- $Date: 2008-09-11 22:05:50 +0200 (to, 11 sep 2008) $
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
This method is called at when the agent is stopped or paused.void
executeJob
(SessionControl sc, Agent agent, Job job, JobAgentSettings settings, Job.ExecutionTime usedSlot) Execute the specified job.void
Initialize the job executor.
-
Method Details
-
init
Initialize the job executor. This method is called once immediately after the object has been created.- Parameters:
agent
- The agent
-
executeJob
void executeJob(SessionControl sc, Agent agent, Job job, JobAgentSettings settings, Job.ExecutionTime usedSlot) Execute the specified job. This method is called in a new thread created specifically for running that job. If the agent is shutting down it will send an interrupt signal to all job threads. It is up to the job executor to decide how to handle this. It may either decide to kill the job or let it continue as if nothing happened.The job sent to this method has it's status set to
Job.Status.PREPARED
. The implementation of this method must change the status to eitherJob.Status.DONE
orJob.Status.ERROR
. If the status hasn't changed the job agent will set the status to signal an unknown error.- Parameters:
sc
- ASessionControl
where the owner of the job is logged in and the correct active project is setagent
- The agent that sent the request to execute the jobjob
- The job to executesettings
- The specific settings used for the plugin on this job agent or null if no settings has been specifiedusedSlot
- The slot that was used to execut the job
-
close
void close()This method is called at when the agent is stopped or paused. No more execution requests will be sent to the current job executor, but running jobs should NOT be terminated due to this method beeing called.
-