Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Java
multiple concurrent processes
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Robert Klemme, post: 643869"] InputStream.read(new byte[0],0,0) should return -1 on EOF - but it may block. IMHO it's too complicated to create an algorithm that makes assumptions when the stream might be at EOF. In this case a solution is to check process status by invoking exitStatus() and catching the exception like public static boolean running(Process p) { try { p.exitStatus(); return false; } catch ( IllegalStateException e ) { return true; } } [URL]http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Process.html#exitValue()[/URL] Thread overhead isn't really that high so IMHO it's best to just use threads. At least this is what I'd trie *before* I start optimizing threads away. Kind regards robert [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Java
multiple concurrent processes
Top