public class ThreadJobExecutor extends java.lang.Object implements JobExecutor
System.exit(int)
would result in
all other jobs as well as the job agent getting killed.
The advantage is that there is no overhead in time or memory.
Modifier and Type | Class and Description |
---|---|
private static class |
ThreadJobExecutor.ShutdownHook |
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
log
Log job agent events.
|
private SignalReceiver |
signalReceiver |
Constructor and Description |
---|
ThreadJobExecutor() |
Modifier and Type | Method and Description |
---|---|
void |
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 |
init(Agent agent)
Initialize the job executor.
|
static void |
main(java.lang.String[] args) |
private void |
setSignalReceiver(SignalReceiver signalReceiver) |
private static final org.slf4j.Logger log
private SignalReceiver signalReceiver
public void init(Agent agent)
JobExecutor
init
in interface JobExecutor
agent
- The agentpublic void executeJob(SessionControl sc, Agent agent, Job job, JobAgentSettings settings, Job.ExecutionTime usedSlot)
JobExecutor
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 either
Job.Status.DONE
or Job.Status.ERROR
. If the status hasn't changed
the job agent will set the status to signal an unknown error.
executeJob
in interface JobExecutor
sc
- A SessionControl
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 jobpublic void close()
JobExecutor
close
in interface JobExecutor
private void setSignalReceiver(SignalReceiver signalReceiver)
public static void main(java.lang.String[] args)