The submitJob() method immediately returns control to the calling program, without waiting for the hadoop job to run, and moreover, its complete completion. If you want to wait, use the waitForCompletion() method, which returns only after the hadoop job has completed. I think you want something in between, since you want to run the following code after sending, but before completion.
I suggest you put your next code in a loop that continues until the task is completed (use the isComplete() method for this test) and observe the mappers and gearboxes as the task progresses. You probably also want to put Thread.sleep (xxx) in a loop.
To answer your comment you want ...
job.waitForCompletion(); TaskCompletionEvent event[] = job.getTaskCompletionEvents(); for (int i = 0; i < event.length(); i++) { System.out.println("Task "+i+" took "+event[i].getTaskRunTime()+" ms"); }
source share