Package com.linkedin.venice.utils
Class ForkedJavaProcess
java.lang.Object
java.lang.Process
com.linkedin.venice.utils.ForkedJavaProcess
Adapted from https://stackoverflow.com/a/723914/791758
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
static ForkedJavaProcess
static ForkedJavaProcess
static ForkedJavaProcess
static ForkedJavaProcess
exec
(Class appClass, List<String> args, List<String> jvmArgs, boolean killOnExit, Optional<String> loggerPrefix) static ForkedJavaProcess
exec
(Class appClass, List<String> args, List<String> jvmArgs, String classPath, boolean killOnExit, Optional<String> loggerPrefix) int
static String
long
pid()
static void
int
waitFor()
Methods inherited from class java.lang.Process
children, descendants, destroyForcibly, errorReader, errorReader, info, inputReader, inputReader, isAlive, onExit, outputWriter, outputWriter, supportsNormalTermination, toHandle, waitFor
-
Method Details
-
exec
public static ForkedJavaProcess exec(Class appClass, List<String> args, List<String> jvmArgs, String classPath, boolean killOnExit, Optional<String> loggerPrefix) throws IOException - Throws:
IOException
-
exec
public static ForkedJavaProcess exec(Class appClass, List<String> args, List<String> jvmArgs, boolean killOnExit, Optional<String> loggerPrefix) throws IOException - Throws:
IOException
-
exec
public static ForkedJavaProcess exec(Class appClass, List<String> args, List<String> jvmArgs, boolean killOnExit) throws IOException - Throws:
IOException
-
exec
public static ForkedJavaProcess exec(Class appClass, List<String> args, List<String> jvmArgs) throws IOException - Throws:
IOException
-
exec
- Throws:
IOException
-
getClasspath
-
destroy
public void destroy() -
processAndExtractLevelFromForkedProcessLog
public static void processAndExtractLevelFromForkedProcessLog(ForkedJavaProcess.LogInfo logInfo, String log) -
pid
public long pid() -
getOutputStream
- Specified by:
getOutputStream
in classProcess
-
getInputStream
- Specified by:
getInputStream
in classProcess
-
getErrorStream
- Specified by:
getErrorStream
in classProcess
-
waitFor
- Specified by:
waitFor
in classProcess
- Throws:
InterruptedException
-
exitValue
public int exitValue()
-