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? Will the following consume more memory in jvm......... is there any alternate way of invoking process or running perl scripts......... 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; } } ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ------ // ------------- code snippet....... String[] params = new String[4]; String perlPath=props.getProperty("path.perl"); String perlProgPath=props.getProperty("path.cgi")+"bp/BPOnDemand.pl"; String opFilePath=props.getProperty("path.tmp")+opFile; params[0] = perlPath; params[1] = perlProgPath; params[2] = ipFilePath; params[3] = opFilePath; Process process = new ProcessBuilder(params).start(); process.waitFor(); ---------------------------------------------------------------------------- ----------------------------------------------------------------------