Package com.linkedin.venice.utils
Class ForkedJavaProcess
- java.lang.Object
-
- java.lang.Process
-
- com.linkedin.venice.utils.ForkedJavaProcess
-
public final class ForkedJavaProcess extends java.lang.Process
Adapted from https://stackoverflow.com/a/723914/791758
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ForkedJavaProcess.LogInfo
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
static ForkedJavaProcess
exec(java.lang.Class appClass, java.lang.String... args)
static ForkedJavaProcess
exec(java.lang.Class appClass, java.util.List<java.lang.String> args, java.util.List<java.lang.String> jvmArgs)
static ForkedJavaProcess
exec(java.lang.Class appClass, java.util.List<java.lang.String> args, java.util.List<java.lang.String> jvmArgs, boolean killOnExit)
static ForkedJavaProcess
exec(java.lang.Class appClass, java.util.List<java.lang.String> args, java.util.List<java.lang.String> jvmArgs, boolean killOnExit, java.util.Optional<java.lang.String> loggerPrefix)
static ForkedJavaProcess
exec(java.lang.Class appClass, java.util.List<java.lang.String> args, java.util.List<java.lang.String> jvmArgs, java.lang.String classPath, boolean killOnExit, java.util.Optional<java.lang.String> loggerPrefix)
int
exitValue()
static java.lang.String
getClasspath()
java.io.InputStream
getErrorStream()
java.io.InputStream
getInputStream()
java.io.OutputStream
getOutputStream()
long
pid()
static void
processAndExtractLevelFromForkedProcessLog(ForkedJavaProcess.LogInfo logInfo, java.lang.String log)
int
waitFor()
-
-
-
Method Detail
-
exec
public static ForkedJavaProcess exec(java.lang.Class appClass, java.util.List<java.lang.String> args, java.util.List<java.lang.String> jvmArgs, java.lang.String classPath, boolean killOnExit, java.util.Optional<java.lang.String> loggerPrefix) throws java.io.IOException
- Throws:
java.io.IOException
-
exec
public static ForkedJavaProcess exec(java.lang.Class appClass, java.util.List<java.lang.String> args, java.util.List<java.lang.String> jvmArgs, boolean killOnExit, java.util.Optional<java.lang.String> loggerPrefix) throws java.io.IOException
- Throws:
java.io.IOException
-
exec
public static ForkedJavaProcess exec(java.lang.Class appClass, java.util.List<java.lang.String> args, java.util.List<java.lang.String> jvmArgs, boolean killOnExit) throws java.io.IOException
- Throws:
java.io.IOException
-
exec
public static ForkedJavaProcess exec(java.lang.Class appClass, java.util.List<java.lang.String> args, java.util.List<java.lang.String> jvmArgs) throws java.io.IOException
- Throws:
java.io.IOException
-
exec
public static ForkedJavaProcess exec(java.lang.Class appClass, java.lang.String... args) throws java.io.IOException
- Throws:
java.io.IOException
-
getClasspath
public static java.lang.String getClasspath()
-
destroy
public void destroy()
- Specified by:
destroy
in classjava.lang.Process
-
processAndExtractLevelFromForkedProcessLog
public static void processAndExtractLevelFromForkedProcessLog(ForkedJavaProcess.LogInfo logInfo, java.lang.String log)
-
pid
public long pid()
- Overrides:
pid
in classjava.lang.Process
-
getOutputStream
public java.io.OutputStream getOutputStream()
- Specified by:
getOutputStream
in classjava.lang.Process
-
getInputStream
public java.io.InputStream getInputStream()
- Specified by:
getInputStream
in classjava.lang.Process
-
getErrorStream
public java.io.InputStream getErrorStream()
- Specified by:
getErrorStream
in classjava.lang.Process
-
waitFor
public int waitFor() throws java.lang.InterruptedException
- Specified by:
waitFor
in classjava.lang.Process
- Throws:
java.lang.InterruptedException
-
exitValue
public int exitValue()
- Specified by:
exitValue
in classjava.lang.Process
-
-