Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java Process

Status
Not open for further replies.

ahsan786

Technical User
Feb 4, 2004
12
HK
execProcess = rt.exec("cmd /c C:/prg.exe < C:/in.txt > C:/pout.txt",null, "C:/");
while((System.currentTimeMillis() < (startTime + maxAllowTime))){ //for each test case
try{
if(execProcess.exitValue() == 0){
break;
}else{
break;//terminate the process abnormal???
}
}catch(IllegalThreadStateException itse){ //the process hasn't finished
}
}
---------------------------------------------------
execProcess = rt.exec("cmd /c C:/prg.exe < C:/in.txt > C:/pout.txt",null, "C:/");

Tomcat server is used.
When many clients do the request at the same time the pout.txt files is output empty.
i dont know why?
 
Probably because you are opening many output streams and file handles to that file object, and it is screwing the OS's IO. You should only ever write to a file with once process at a time.

You should either write to different out files, or synchronize the operation within the servlet.

--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top