| Author |
Multi-Thread command line executor cause uncertain result
|
Zee Ho
Ranch Hand
Joined: Jul 20, 2004
Posts: 128
|
|
All, I have writen a Java program to execute the external program. sth like execute "cat < abc.xml" and such java program will return same result as linux command. I test the program use such way : give my program 64 same file and let it execute them. In some of the machine the task 100% completed, while in some machine several task failed with exceptions as : - 2005-10-12 [Thread-712] java.io.IOException: Stream closed OR - 2005-10-12 [Thread-878] java.io.IOException: Bad file descriptor (I am still the file is not missing) I know using thread is error-prone, but I can not figure out what mistake I have made. any suggestion on ehancing the program?
|
SCJP 1.4<br />SCWCD 1.3<br />SCJD<br />SCBCD<br />IBM Xml Cert in progress
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24054
|
|
Please CarefullyChooseOneForum for your questions. Don't post the same question to multiple forums. I've deleted the one in Java in General (Beginner), as this is not what I'd call "beginner" code. So what's different about the machines where this fails? What OS are they running? Are they all the same?
|
[Jess in Action][AskingGoodQuestions]
|
 |
Zee Ho
Ranch Hand
Joined: Jul 20, 2004
Posts: 128
|
|
No one is suse unix and another is redhat linux. in redhat, seems 100% complete.
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24054
|
|
|
Are you running the Sun JVM on both, or is the failing one Kaffe or some other open-source VM?
|
 |
Zee Ho
Ranch Hand
Joined: Jul 20, 2004
Posts: 128
|
|
I run on same Sun's java vm As I can not find out a way to make it stable I changed my way to execute the external program that I develop a .sh file which take 3 parameter as $1 < $2 > $3 then the way I run the arbitrary program become 1. obtain the program path for $1 2. write the input file to file system rather than manipulating the input/output stream through the Process class. $2 became the input file path 3. offer the destination file path for $3 then let the underlying OS execute the .sh became more stable than my previous solution would like share this idea to ranchers if helpful [ October 13, 2005: Message edited by: Zee Ho ]
|
 |
 |
|
|
subject: Multi-Thread command line executor cause uncertain result
|
|
|