public class JobProcessManagerImpl extends java.lang.Object implements JobProcessManager
Constructor and Description |
---|
JobProcessManagerImpl(org.springframework.scheduling.TaskScheduler taskScheduler)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
kill(KillService.KillSource source)
Terminate job process execution (if still running) or prevent it from launching (if not launched yet).
|
void |
launchProcess(java.io.File jobDirectory,
java.util.Map<java.lang.String,java.lang.String> environmentVariablesMap,
java.util.List<java.lang.String> commandArguments,
java.util.List<java.lang.String> jobArguments,
boolean interactive,
java.lang.Integer timeout)
Launch the job process (unless launch was aborted by previous a
kill call). |
void |
onApplicationEvent(KillService.KillEvent event) |
JobProcessResult |
waitFor()
Wait indefinitely for the job process to terminate.
|
public JobProcessManagerImpl(org.springframework.scheduling.TaskScheduler taskScheduler)
taskScheduler
- The TaskScheduler
instance to use to run scheduled asynchronous taskspublic void launchProcess(java.io.File jobDirectory, java.util.Map<java.lang.String,java.lang.String> environmentVariablesMap, java.util.List<java.lang.String> commandArguments, java.util.List<java.lang.String> jobArguments, boolean interactive, @Nullable java.lang.Integer timeout) throws JobLaunchException
kill
call).launchProcess
in interface JobProcessManager
jobDirectory
- Job directoryenvironmentVariablesMap
- additional environment variables (to merge on top of inherited environment)commandArguments
- command-line executable and its fixed arguments argumentsjobArguments
- job-specific argumentsinteractive
- launch in interactive mode (inherit I/O) or batch (no input, write outputs to files)timeout
- The optional number of seconds this job is allowed to run before the system will
kill itJobLaunchException
- if the job process failed to launchpublic void kill(KillService.KillSource source)
kill
in interface JobProcessManager
source
- The KillService.KillSource
value representing where this kill request is coming frompublic JobProcessResult waitFor() throws java.lang.InterruptedException
waitFor
in interface JobProcessManager
java.lang.InterruptedException
- if the calling thread is interrupted while waitingpublic void onApplicationEvent(KillService.KillEvent event)
onApplicationEvent
in interface org.springframework.context.ApplicationListener<KillService.KillEvent>