$darkmode
DENOPTIM
denoptim.task.ProcessHandler Class Reference

Public Member Functions

 ProcessHandler (String cmdStr, String id)
 
void runProcessInBASH () throws DENOPTIMException
 Run the process associated with the command from BASH http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=4 For any Process, the input and error streams must read even if the data written to these streams is not used by the application. More...
 
void runProcess () throws DENOPTIMException
 Run the process associated with the command. More...
 
String getStandardOutput ()
 Get the content of the standard output for the process. More...
 
String getErrorOutput ()
 Get the content of the error output for the process. More...
 
int getExitCode ()
 Get the exit code returned by the sub-process. More...
 
void stopProcess ()
 

Private Attributes

int exitCode
 
transient Process proc = null
 
String standardOutput
 Content of the standard output for the process. More...
 
String errorOutput
 Content of the error output for the process. More...
 
String id = null
 A user-assigned id for this task. More...
 
String cmdStr = null
 

Detailed Description

Author
Vishwesh Venkatraman

Definition at line 32 of file ProcessHandler.java.

Constructor & Destructor Documentation

◆ ProcessHandler()

denoptim.task.ProcessHandler.ProcessHandler ( String  cmdStr,
String  id 
)

Member Function Documentation

◆ getErrorOutput()

String denoptim.task.ProcessHandler.getErrorOutput ( )

Get the content of the error output for the process.

Returns
the output as a string.

Definition at line 268 of file ProcessHandler.java.

References denoptim.task.ProcessHandler.errorOutput.

Referenced by denoptim.integration.tinker.ConformationalSearchPSSROT.performPSSROT(), and denoptim.task.FitnessTask.runExternalFitness().

Here is the caller graph for this function:

◆ getExitCode()

int denoptim.task.ProcessHandler.getExitCode ( )

Get the exit code returned by the sub-process.

Returns
the value of the exit code returned by the sub-process. A negative value indicates the process was never launched or never returned.
See also
java.lang.Process::waitFor()

Definition at line 281 of file ProcessHandler.java.

References denoptim.task.ProcessHandler.exitCode.

Referenced by denoptim.integration.tinker.ConformationalSearchPSSROT.performPSSROT(), and denoptim.task.FitnessTask.runExternalFitness().

Here is the caller graph for this function:

◆ getStandardOutput()

String denoptim.task.ProcessHandler.getStandardOutput ( )

Get the content of the standard output for the process.

Returns
the output as a string.

Definition at line 257 of file ProcessHandler.java.

References denoptim.task.ProcessHandler.standardOutput.

◆ runProcess()

void denoptim.task.ProcessHandler.runProcess ( ) throws DENOPTIMException

Run the process associated with the command.

http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=4 For any Process, the input and error streams must read even if the data written to these streams is not used by the application. The generally accepted solution for this problem is a stream gobbler thread that does nothing but consume data from an input stream until stopped.

Exceptions
DENOPTIMException
Exception

Definition at line 168 of file ProcessHandler.java.

References denoptim.task.ProcessHandler.cmdStr, denoptim.task.ProcessHandler.errorOutput, denoptim.task.ProcessHandler.exitCode, denoptim.task.StreamGobbler.getMessages(), denoptim.task.ProcessHandler.proc, denoptim.task.StreamGobbler.sb, and denoptim.task.ProcessHandler.standardOutput.

Referenced by denoptim.task.FitnessTask.runExternalFitness().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ runProcessInBASH()

void denoptim.task.ProcessHandler.runProcessInBASH ( ) throws DENOPTIMException

Run the process associated with the command from BASH http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=4 For any Process, the input and error streams must read even if the data written to these streams is not used by the application.

The generally accepted solution for this problem is a stream gobbler thread that does nothing but consume data from an input stream until stopped.

Exceptions
DENOPTIMException
Exception

Definition at line 77 of file ProcessHandler.java.

References denoptim.task.ProcessHandler.cmdStr, denoptim.task.ProcessHandler.errorOutput, denoptim.task.ProcessHandler.exitCode, denoptim.task.StreamGobbler.getMessages(), denoptim.task.ProcessHandler.proc, denoptim.task.StreamGobbler.sb, and denoptim.task.ProcessHandler.standardOutput.

Referenced by denoptim.integration.tinker.ConformationalSearchPSSROT.performPSSROT().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stopProcess()

void denoptim.task.ProcessHandler.stopProcess ( )

Definition at line 288 of file ProcessHandler.java.

References denoptim.task.ProcessHandler.proc.

Referenced by denoptim.task.Task.stopTask().

Here is the caller graph for this function:

Member Data Documentation

◆ cmdStr

String denoptim.task.ProcessHandler.cmdStr = null
private

◆ errorOutput

String denoptim.task.ProcessHandler.errorOutput
private

◆ exitCode

int denoptim.task.ProcessHandler.exitCode
private

◆ id

String denoptim.task.ProcessHandler.id = null
private

A user-assigned id for this task.

Definition at line 51 of file ProcessHandler.java.

Referenced by denoptim.task.ProcessHandler.ProcessHandler().

◆ proc

transient Process denoptim.task.ProcessHandler.proc = null
private

◆ standardOutput

String denoptim.task.ProcessHandler.standardOutput
private

The documentation for this class was generated from the following file: