I am using Runtime.exec() to execute the graph from Java.Graph runs pretty well and outputs 800000 records and it doesn't stop either the JVM or the graph but stops writing to the output.
When I see the log's the out: and KB never change for the rest of the time.I tried increasing the JVM, log level off,no debug no change.
I assumed my command or my graph was wrong so tried executing the same graph via command line it executes perfectly and gives me result more than 800000 records.
Below is the sample code.please suggest me what's wrong with my code or did i miss any arguments?
public String Graph() {
graph ="java -Djava.io.tmpdir=/opt/tomcat/ -cp com.clover/lib/lib/* org.jetel.main.runGraph
-plugins clover/lib/plugins -loglevel OFF -checkconfig -nodebug -config properties/defaultProperties.cfg
-debugdirectory Debug graph.grf";
return graph;
}
public void runGraph() {
try {
p = Runtime.getRuntime().exec(Graph());
readProcess(p,"graph failed");
} catch (IOException e) {
e.printStackTrace();
}
}
public void readProcess(Process p2, String sub) {
String s="",message="";
try{
stdInput = new BufferedReader(new InputStreamReader(p2.getInputStream()));
stdErr = new BufferedReader(new InputStreamReader(p2.getErrorStream()));
int i=0;
while ((s = stdInput.readLine()) != null) {
if (s.contains("ERROR") && !s.isEmpty()) {
message += s + "\r\n";
while ((s = stdInput.readLine()) != null) {
if (s.contains("TIMER") || s.contains("INFO") || s.startsWith("DEBUG") || s.startsWith("INFO"))
break;
message += s + "\r\n";
}
}
}
while((s = stdErr.readLine()) != null){
message += s + "\r\n";
}
if (message != "") {
email.setBody(message);
email.setSubject(sub);
email.send();
System.out.println(sub);
System.exit(0);
}
}catch(IOException e){
e.printStackTrace();
}
}