Package boofcv.gui

Class JavaRuntimeLauncher

java.lang.Object
boofcv.gui.JavaRuntimeLauncher

public class JavaRuntimeLauncher extends Object
Class for launching JVMs. Monitors the status and kills frozen threads. Keeps track of execution time and sets up class path. Output and error stream can be changed at any time and is designed to be thread safe.
  • Constructor Details

    • JavaRuntimeLauncher

      public JavaRuntimeLauncher(@Nullable @Nullable List<String> pathJars)
      Constructor. Configures which library it is to be launching a class from/related to
      Parameters:
      pathJars - List of paths to all the jars
  • Method Details

    • setFrozenTime

      public void setFrozenTime(long frozenTime)
      Specifies the amount of time the process has to complete. After which it is considered frozen and will be killed
      Parameters:
      frozenTime - time in milliseconds
    • setMemoryInMB

      public void setMemoryInMB(long memoryInMB)
      Specifies the amount of memory the process will be allocated in megabytes
      Parameters:
      memoryInMB - megabytes
    • getDurationMilli

      public long getDurationMilli()
      Returns how long the operation took to complete. In milliseconds
    • launch

      public JavaRuntimeLauncher.Exit launch(Class mainClass, String... args)
      Launches the class with the provided arguments. Blocks until the process stops.
      Parameters:
      mainClass - Class
      args - it's arguments
      Returns:
      true if successful or false if it ended on error
    • printBuffer

      protected void printBuffer(BufferedReader input, PrintStream output) throws IOException
      Throws:
      IOException
    • getClassPath

      public String getClassPath()
    • getAllocatedMemoryInMB

      public long getAllocatedMemoryInMB()
    • getFrozenTime

      public long getFrozenTime()
    • getArguments

      public String[] getArguments()
    • requestKill

      public void requestKill()
    • isKillRequested

      public boolean isKillRequested()
    • getPrintOut

      public PrintStream getPrintOut()
    • setPrintOut

      public void setPrintOut(PrintStream out)
    • getPrintErr

      public PrintStream getPrintErr()
    • setPrintErr

      public void setPrintErr(PrintStream err)