Class ProcessJobExecutor
java.lang.Object
net.sf.basedb.clients.jobagent.executors.ProcessJobExecutor
- All Implemented Interfaces:
JobExecutor
This is a job executor which starts a new process for each job to be
executed. This has the advantage that a misbehaving job can't
interfere with other jobs or the job agent. For example, a
call to
System.exit(int)
would only result in
the job's process getting killed. Other jobs and the job agent would not
be affected. Another advantage is that it makes it possible to apply
a security policy to the new process for plugins that are not trusted with
full access to the computer. See PluginDefinition.isTrusted()
.
The disadvantage is the overhead in time and memory of starting a new process.
Configuration parameter | Default value | Description |
---|---|---|
agent.executor.process.java |
Path to the java executable to use. not specified the envoronment variable
JAVA_HOME is used if it exists. Otherwise we let the operating
system find the java command.
|
|
agent.executor.process.options | -server |
Extra command line options to pass to the java executable:
java <options> -cp ... className ... .
|
- Version:
- 2.0
- Author:
- nicklas
- Last modified
- $Date: 2021-06-04 12:40:45 +0200 (Fri, 04 Jun 2021) $
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Used for redirecting standard output to a string. -
Field Summary
Modifier and TypeFieldDescriptionprivate String
private static final Logger
Log job agent events.private String
private SignalHandler
private SignalReceiver
-
Constructor Summary
-
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.
-
Field Details
-
log
Log job agent events. -
javaBin
-
options
-
signalReceiver
-
signalHandler
-
-
Constructor Details
-
ProcessJobExecutor
public ProcessJobExecutor()
-
-
Method Details
-
init
Description copied from interface:JobExecutor
Initialize the job executor. This method is called once immediately after the object has been created.- Specified by:
init
in interfaceJobExecutor
- Parameters:
agent
- The agent
-
executeJob
public void executeJob(SessionControl sc, Agent agent, Job job, JobAgentSettings settings, Job.ExecutionTime usedSlot) Description copied from interface:JobExecutor
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.- Specified by:
executeJob
in interfaceJobExecutor
- 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
public void close()Description copied from interface:JobExecutor
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.- Specified by:
close
in interfaceJobExecutor
-