byte param = input.readByte();
// If it failed
if(param != DomainControllerProtocol.PARAM_OK) {
final byte errorCode = input.readByte();
final String message = input.readUTF();
resultHandler.failed(new SlaveRegistrationException(SlaveRegistrationException.ErrorCode.parseCode(errorCode), message));
return;
}
final ModelNode domainModel = new ModelNode();
domainModel.readExternal(input);
context.executeAsync(new ManagementRequestContext.AsyncTask<Void>() {
@Override
public void execute(ManagementRequestContext<Void> voidManagementRequestContext) throws Exception {
// Apply the domain model
final boolean success = applyDomainModel(domainModel);
if(success) {
channelHandler.executeRequest(context.getOperationId(), new CompleteRegistrationRequest(DomainControllerProtocol.PARAM_OK));
} else {
channelHandler.executeRequest(context.getOperationId(), new CompleteRegistrationRequest(DomainControllerProtocol.PARAM_ERROR));
resultHandler.failed(new SlaveRegistrationException(SlaveRegistrationException.ErrorCode.UNKNOWN, ""));
}
}
});
}