|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.clients.jobagent.executors.ProcessJobExecutor
public class ProcessJobExecutor
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 ... .
|
Nested Class Summary | |
---|---|
static class |
ProcessJobExecutor.StreamRedirector
Used for redirecting standard output to a string. |
Field Summary | |
---|---|
private String |
javaBin
|
private static Logger |
log
Log job agent events. |
private String |
options
|
private SignalHandler |
signalHandler
|
private SignalReceiver |
signalReceiver
|
Constructor Summary | |
---|---|
ProcessJobExecutor()
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Logger log
private String javaBin
private String options
private SignalReceiver signalReceiver
private SignalHandler signalHandler
Constructor Detail |
---|
public ProcessJobExecutor()
Method Detail |
---|
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
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |