* @param masterStepExecution the parent step execution
*/
protected void waitCompleteState(final StepExecution masterStepExecution) {
final CountDownLatch latch = new CountDownLatch(1);
batchAppmaster.addAppmasterStateListener(new AppmasterStateListener() {
@Override
public void state(AppmasterState state) {
log.info("AppmasterStateListener state=[" + state + "]");
if(state == AppmasterState.COMPLETED || state == AppmasterState.FAILED) {
latch.countDown();