@Override public void handleRequest( final DataInput input, final ActiveOperation.ResultHandler<Void> resultHandler, final ManagementRequestContext<Void> context) throws IOException { 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 extensions = new ModelNode(); extensions.readExternal(input); context.executeAsync( new ManagementRequestContext.AsyncTask<Void>() { @Override public void execute(ManagementRequestContext<Void> voidManagementRequestContext) throws Exception { // final ModelNode subsystems = resolveSubsystemVersions(extensions); channelHandler.executeRequest( context.getOperationId(), new RegisterSubsystemsRequest(subsystems)); } }); }
@Override public void handleRequest( final DataInput input, final ActiveOperation.ResultHandler<Void> resultHandler, final ManagementRequestContext<Void> context) throws IOException { 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, "")); } } }); }