Package boofcv.gui
Class JavaRuntimeLauncher
java.lang.Object
boofcv.gui.JavaRuntimeLauncher
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.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
String[]
long
Returns how long the operation took to complete.long
boolean
Launches the class with the provided arguments.protected void
printBuffer
(BufferedReader input, PrintStream output) void
void
setFrozenTime
(long frozenTime) Specifies the amount of time the process has to complete.void
setMemoryInMB
(long memoryInMB) Specifies the amount of memory the process will be allocated in megabytesvoid
setPrintErr
(PrintStream err) void
setPrintOut
(PrintStream out)
-
Constructor Details
-
JavaRuntimeLauncher
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
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
- Throws:
IOException
-
getClassPath
-
getAllocatedMemoryInMB
public long getAllocatedMemoryInMB() -
getFrozenTime
public long getFrozenTime() -
getArguments
-
requestKill
public void requestKill() -
isKillRequested
public boolean isKillRequested() -
getPrintOut
-
setPrintOut
-
getPrintErr
-
setPrintErr
-