Problems with multiple threaded Runtime.exec()
Hi!
I want to use Runtime.exec(..) to call a script/batchfile from my program. Everything works fine.
Now I want to speed up execution of multiple Runtime.exec(..) and therefore each Runtime.exec(..) is started in its own Thread to call them parallel. If the number of parallel Runtime.exec() is quite high (~100) I sometimes get the exitValue -1073741502 under Windows. In this case there is no output on the standard and error stream.
Does anybody know the meaning of this exitValue? Is there any limitation for concurrent Runtime.exec() calls under Windows?
Note: I have read and implemented the advices of the guide at http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=1.
[727 byte] By [
uvoigta] at [2007-11-26 21:37:14]

Why would you want 100 concurrent Runtime processes running
together?
You can just call an external process to run without monitoring or
threading them.
I assume youre either reading or writing from the process streams then?
Anyway, Google provides many excellent results
http://www.google.com/search?hl=en&q=windows+exit+value+1073741502+
Google has any answer... ;-)
What I've found so far is that the exit value 1073741502 has the meaning "DLL not initialized" or it is a graphic card problem. But why?
For test purposes my batch file only contains one simple ping command. Most of the batch file calls are working, only a few are not.
> Hi!
>
> I want to use Runtime.exec(..) to call a
> script/batchfile from my program. Everything works
> fine.
>
> Now I want to speed up execution of multiple
> Runtime.exec(..) and therefore each Runtime.exec(..)
> is started in its own Thread to call them parallel.
> If the number of parallel Runtime.exec() is quite
> high (~100) I sometimes get the exitValue -1073741502
> under Windows. In this case there is no output on the
> standard and error stream.
>
> Does anybody know the meaning of this exitValue? Is
> there any limitation for concurrent Runtime.exec()
> calls under Windows?
>
I donno about threshold number for the Runtime.exec() calls. But calling more process objects is a very expensive operation. Because for executing every process object JVM need open I/O stream, and needs lot of OS level system calls invocation.
But instead you can write a wrapper script to run the batch file multiple times say for ~100. Here you can also push each batch script error and output streams to respective files.
Hope this helps.