阅读背景:

Java:如何使这个主线程等待新线程终止

来源:互联网 

I have a java class that creates a process, called child, using ProcessBuilder. The child process generates a lot of output that I am draining on a separate thread to keep the main thread from getting blocked. However, a little later on I need to wait for the output thread to complete/terminate before going on, and I'm not sure how to do that. I think that join() is the usual way to do this but I'm not sure how to do that in this case. Here is the relevant part of the java code.I have a java class that creates a process, cal




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: