Class ForkedJavaProcess


  • public final class ForkedJavaProcess
    extends java.lang.Process
    Adapted from https://stackoverflow.com/a/723914/791758
    • 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()  
      • Methods inherited from class java.lang.Process

        children, descendants, destroyForcibly, info, isAlive, onExit, supportsNormalTermination, toHandle, waitFor
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 class java.lang.Process
      • processAndExtractLevelFromForkedProcessLog

        public static void processAndExtractLevelFromForkedProcessLog​(ForkedJavaProcess.LogInfo logInfo,
                                                                      java.lang.String log)
      • pid

        public long pid()
        Overrides:
        pid in class java.lang.Process
      • getOutputStream

        public java.io.OutputStream getOutputStream()
        Specified by:
        getOutputStream in class java.lang.Process
      • getInputStream

        public java.io.InputStream getInputStream()
        Specified by:
        getInputStream in class java.lang.Process
      • getErrorStream

        public java.io.InputStream getErrorStream()
        Specified by:
        getErrorStream in class java.lang.Process
      • waitFor

        public int waitFor()
                    throws java.lang.InterruptedException
        Specified by:
        waitFor in class java.lang.Process
        Throws:
        java.lang.InterruptedException
      • exitValue

        public int exitValue()
        Specified by:
        exitValue in class java.lang.Process