@Override
protected void doStart() {
super.doStart();
AppmasterService service = getAppmasterService();
if(log.isDebugEnabled() && service != null) {
log.debug("We have a appmaster service " + service);
}
if(service instanceof BatchAppmasterService) {
((BatchAppmasterService)service).addInterceptor(new JobRepositoryRemoteServiceInterceptor() {
@Override
public BaseObject preRequest(BaseObject baseObject) {
if(baseObject.getType().equals("PartitionedStepExecutionStatusReq")) {
StepExecutionType stepExecutionType = ((PartitionedStepExecutionStatusReq)baseObject).stepExecution;
StepExecution convertStepExecution = JobRepositoryRpcFactory.convertStepExecutionType(stepExecutionType);
getStepExecutions().add(convertStepExecution);
return null;
} else {
return baseObject;
}
}
@Override
public BaseResponseObject postRequest(BaseResponseObject baseResponseObject) {
return baseResponseObject;
}
@Override
public BaseResponseObject handleRequest(BaseObject baseObject) {
return new PartitionedStepExecutionStatusRes();
}
});
}
if(service != null && service.hasPort()) {
for(int i=0; i<10; i++) {
if(service.getPort() == -1) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
}
} else {