Class ProcessManager
- java.lang.Object
-
- org.apache.beam.runners.fnexecution.environment.ProcessManager
-
@ThreadSafe public class ProcessManager extends java.lang.ObjectA simple process manager which forks processes and kills them if necessary.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classProcessManager.RunningProcess
-
Field Summary
Fields Modifier and Type Field Description static java.io.FileINHERIT_IO_FILEA symbolic file to indicate that we want to inherit I/O of parent process.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ProcessManagercreate()ProcessManager.RunningProcessstartProcess(java.lang.String id, java.lang.String command, java.util.List<java.lang.String> args, java.util.Map<java.lang.String,java.lang.String> env)Forks a process with the given command, arguments, and additional environment variables.ProcessManager.RunningProcessstartProcess(java.lang.String id, java.lang.String command, java.util.List<java.lang.String> args, java.util.Map<java.lang.String,java.lang.String> env, java.io.File outputFile)voidstopProcess(java.lang.String id)Stops a previously started process identified by its unique id.
-
-
-
Method Detail
-
create
public static ProcessManager create()
-
startProcess
public ProcessManager.RunningProcess startProcess(java.lang.String id, java.lang.String command, java.util.List<java.lang.String> args, java.util.Map<java.lang.String,java.lang.String> env) throws java.io.IOException
Forks a process with the given command, arguments, and additional environment variables.- Parameters:
id- A unique id for the processcommand- The name of the executable to runargs- Arguments to provide to the executableenv- Additional environment variables for the process to be forked- Returns:
- A RunningProcess which can be checked for liveness
- Throws:
java.io.IOException
-
startProcess
public ProcessManager.RunningProcess startProcess(java.lang.String id, java.lang.String command, java.util.List<java.lang.String> args, java.util.Map<java.lang.String,java.lang.String> env, java.io.File outputFile) throws java.io.IOException
- Throws:
java.io.IOException
-
stopProcess
public void stopProcess(java.lang.String id)
Stops a previously started process identified by its unique id.
-
-