Package boofcv.gui
Class JavaRuntimeLauncher
- java.lang.Object
-
- boofcv.gui.JavaRuntimeLauncher
-
public class JavaRuntimeLauncher extends java.lang.ObjectClass 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJavaRuntimeLauncher.Exit
-
Constructor Summary
Constructors Constructor Description JavaRuntimeLauncher(java.util.List<java.lang.String> pathJars)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetAllocatedMemoryInMB()java.lang.String[]getArguments()java.lang.StringgetClassPath()longgetDurationMilli()Returns how long the operation took to complete.longgetFrozenTime()java.io.PrintStreamgetPrintErr()java.io.PrintStreamgetPrintOut()booleanisKillRequested()JavaRuntimeLauncher.Exitlaunch(java.lang.Class mainClass, java.lang.String... args)Launches the class with the provided arguments.protected voidprintBuffer(java.io.BufferedReader input, java.io.PrintStream output)voidrequestKill()voidsetFrozenTime(long frozenTime)Specifies the amount of time the process has to complete.voidsetMemoryInMB(long memoryInMB)Specifies the amount of memory the process will be allocated in megabytesvoidsetPrintErr(java.io.PrintStream err)voidsetPrintOut(java.io.PrintStream out)
-
-
-
Method Detail
-
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(java.lang.Class mainClass, java.lang.String... args)
Launches the class with the provided arguments. Blocks until the process stops.- Parameters:
mainClass- Classargs- it's arguments- Returns:
- true if successful or false if it ended on error
-
printBuffer
protected void printBuffer(java.io.BufferedReader input, java.io.PrintStream output) throws java.io.IOException- Throws:
java.io.IOException
-
getClassPath
public java.lang.String getClassPath()
-
getAllocatedMemoryInMB
public long getAllocatedMemoryInMB()
-
getFrozenTime
public long getFrozenTime()
-
getArguments
public java.lang.String[] getArguments()
-
requestKill
public void requestKill()
-
isKillRequested
public boolean isKillRequested()
-
getPrintOut
public java.io.PrintStream getPrintOut()
-
setPrintOut
public void setPrintOut(java.io.PrintStream out)
-
getPrintErr
public java.io.PrintStream getPrintErr()
-
setPrintErr
public void setPrintErr(java.io.PrintStream err)
-
-