tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arun Raj Ramkumar <arura...@cisco.com>
Subject Memory Consumption - Using Process Commands from Java program in Tomcat
Date Fri, 27 Jun 2008 05:47:33 GMT
Hi all,
 
Can you tell me the impact of using following commands in a java program in
tomcat? 
Will they take more memory?
Will they take time to release memory?
Is there any other way we can call? to find best way
print statments on the child perl will affect the parent tomcat?
 
Invoking perl programs like the following ways:
 
1) Process process = new ProcessBuilder(params).start();
 process.waitFor();
 
2) Runtime.getRuntime().exec(command+" &");
 
3) RunCommand runcmd = new RunCommand(cmd);
runcmd.start();
 
----------------------------------------------------------------------------
---------------------------------------------------------
 
For Example
 
public class RunCommand extends Thread {

private final Logger logger=Logger.getLogger(RunCommand.class);

private String commandStr = null;

public RunCommand (String commandStr) {

this.commandStr = commandStr;

}

public void run() {

try {

Process p = Runtime.getRuntime().exec(commandStr);

int exitVal = p.waitFor();

if (p.exitValue() != 0 ) {

logger.warn("CFG Extraction Exited abnormally" + commandStr);

}

} catch (Exception e) {

logger.warn(e.getMessage());

}

}

public String getCommandStr() {

return commandStr;

}

public void setCommandStr(String commandStr) {

this.commandStr = commandStr;

}

}


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message