java - How long does the JVM wait for a thread -
hi every java developper, have juste simple question jvm, want know how long jvm wait thread ? example, take @ code :
public static void main(string[] args) { p = runtime.getruntime().exec("myshellcommand -p1 v1 -p2 v2"); p.waitfor(); system.out.println("end ....:)"); }
suppose "myshellcommand" running ever, whats happen ? jvm still waiting ever ?
the waitfor method causes current thread wait, if necessary, until process represented process object has terminated. method returns if subprocess has terminated. if subprocess has not yet terminated, calling thread will blocked until subprocess exits.(from javadoc).
based on documentation, think run forever.
Comments
Post a Comment