mapreduce job submission through java Processbuilder do not ending mapreduce job submission through java Processbuilder do not ending hadoop hadoop

mapreduce job submission through java Processbuilder do not ending


You should probably redirect stderr to stdout before starting to read:

pb.redirectErrorStream(true)

The reason is described in documentation of the Process class:

... failure to promptly write the input stream or read the output stream of the subprocess may cause the subprocess to block, and even deadlock.

If you are using Java 7, where ProcessBuilder and Process are significantly improved, you could also just do

pb.inheritIO()

which will redirect the process's stderr and stdout to the ones of your Java process.

Update: By the way, you are better off submitting the Hadoop job using the Hadoop API (classes Job and Configuration), see e.g. Calling a mapreduce job from a simple java program