protected Future<Connection> reconnect() { channelHandler.getAttachments().removeAttachment(TransactionalProtocolClient.SEND_IDENTITY); return executorService.submit(new Callable<Connection>() { @Override
protected Future<Connection> reconnect() { channelHandler.getAttachments().removeAttachment(TransactionalProtocolClient.SEND_IDENTITY); return executorService.submit(new Callable<Connection>() { @Override
synchronized TransactionalProtocolClient channelRegistered(final ManagementChannelHandler channelAssociation) { final InternalState current = this.internalState; // Create the remote controller client channelAssociation.getAttachments().attach(TransactionalProtocolClient.SEND_IDENTITY, Boolean.TRUE); channelAssociation.getAttachments().attach(TransactionalProtocolClient.SEND_IN_VM, Boolean.TRUE); final TransactionalProtocolClient remoteClient = TransactionalProtocolHandlers.createClient(channelAssociation); if (current == InternalState.RELOADING) { internalSetState(new TransitionTask() { @Override public boolean execute(ManagedServer server) throws Exception { // Update the current remote connection protocolClient.connected(remoteClient); // clear reload required state requiresReload = false; return true; } }, InternalState.RELOADING, InternalState.SERVER_STARTING); } else { internalSetState(new TransitionTask() { @Override public boolean execute(final ManagedServer server) throws Exception { // Update the current remote connection protocolClient.connected(remoteClient); return true; } // TODO we just check that we are in the correct state, perhaps introduce a new state }, InternalState.SEND_STDIN, InternalState.SERVER_STARTING); } return remoteClient; }
synchronized TransactionalProtocolClient channelRegistered(final ManagementChannelHandler channelAssociation) { final InternalState current = this.internalState; // Create the remote controller client channelAssociation.getAttachments().attach(TransactionalProtocolClient.SEND_IDENTITY, Boolean.TRUE); channelAssociation.getAttachments().attach(TransactionalProtocolClient.SEND_IN_VM, Boolean.TRUE); final TransactionalProtocolClient remoteClient = TransactionalProtocolHandlers.createClient(channelAssociation); if (current == InternalState.RELOADING) { internalSetState(new TransitionTask() { @Override public boolean execute(ManagedServer server) throws Exception { // Update the current remote connection protocolClient.connected(remoteClient); // clear reload required state requiresReload = false; return true; } }, InternalState.RELOADING, InternalState.SERVER_STARTING); } else { internalSetState(new TransitionTask() { @Override public boolean execute(final ManagedServer server) throws Exception { // Update the current remote connection protocolClient.connected(remoteClient); return true; } // TODO we just check that we are in the correct state, perhaps introduce a new state }, InternalState.SEND_STDIN, InternalState.SERVER_STARTING); } return remoteClient; }
@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); // Enable the send subject if (context.getRequestHeader().getVersion() != 1) { channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IDENTITY, Boolean.TRUE); } 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 extensions = new ModelNode(); extensions.readExternal(input); // Enable the send subject if (context.getRequestHeader().getVersion() != 1) { channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IDENTITY, Boolean.TRUE); } 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)); } }); } }
/** * Connect to the HC and retrieve the current model updates. * * @param controller the server controller * @param callback the operation completed callback * * @throws IOException for any error */ synchronized void openConnection(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception { boolean ok = false; final Connection connection = connectionManager.connect(); try { channelHandler.executeRequest(new ServerRegisterRequest(), null, callback); // HC is the same version, so it will support sending the subject channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IDENTITY, Boolean.TRUE); channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IN_VM, Boolean.TRUE); channelHandler.addHandlerFactory(new TransactionalProtocolOperationHandler(controller, channelHandler, responseAttachmentSupport)); ok = true; } finally { if(!ok) { connection.close(); } } }
/** * Connect to the HC and retrieve the current model updates. * * @param controller the server controller * @param callback the operation completed callback * * @throws IOException for any error */ synchronized void openConnection(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception { boolean ok = false; final Connection connection = connectionManager.connect(); try { channelHandler.executeRequest(new ServerRegisterRequest(), null, callback); // HC is the same version, so it will support sending the subject channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IDENTITY, Boolean.TRUE); channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IN_VM, Boolean.TRUE); channelHandler.addHandlerFactory(new TransactionalProtocolOperationHandler(controller, channelHandler, responseAttachmentSupport)); ok = true; } finally { if(!ok) { connection.close(); } } }
/** * Connect to the HC and retrieve the current model updates. * * @param controller the server controller * @param callback the operation completed callback * @return the boot operations * @throws IOException for any error */ synchronized void openConnection(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception { boolean ok = false; final Connection connection = connectionManager.connect(); try { channelHandler.executeRequest(new ServerRegisterRequest(), null, callback); // HC is the same version, so it will support sending the subject channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_SUBJECT, Boolean.TRUE); channelHandler.addHandlerFactory(new TransactionalProtocolOperationHandler(controller, channelHandler)); ok = true; } finally { if(!ok) { connection.close(); } } }
@Override public ManagementChannelHandler startReceiving(final Channel channel) { final ManagementClientChannelStrategy strategy = ManagementClientChannelStrategy.create(channel); final ManagementChannelHandler channelHandler = new ManagementChannelHandler(strategy, executorService); channelHandler.getAttachments().attach(ManagementChannelHandler.TEMP_DIR, tempDir); final ServerToHostProtocolHandler registrationHandler = new ServerToHostProtocolHandler(serverInventory.getValue(), operationExecutor, domainController, channelHandler, registrations, expressionResolver); channelHandler.addHandlerFactory(new ManagementPongRequestHandler()); channelHandler.addHandlerFactory(registrationHandler); channel.receiveMessage(channelHandler.getReceiver()); return channelHandler; }
@Override public ManagementChannelHandler startReceiving(final Channel channel) { final ManagementClientChannelStrategy strategy = ManagementClientChannelStrategy.create(channel); final ManagementChannelHandler channelHandler = new ManagementChannelHandler(strategy, executorService); channelHandler.getAttachments().attach(ManagementChannelHandler.TEMP_DIR, tempDir); final ServerToHostProtocolHandler registrationHandler = new ServerToHostProtocolHandler(serverInventory.getValue(), operationExecutor, domainController, channelHandler, registrations, expressionResolver); channelHandler.addHandlerFactory(new ManagementPongRequestHandler()); channelHandler.addHandlerFactory(registrationHandler); channel.receiveMessage(channelHandler.getReceiver()); return channelHandler; }
@Override public ManagementChannelHandler startReceiving(final Channel channel) { final ManagementChannelHandler handler = new ManagementChannelHandler(ManagementClientChannelStrategy.create(channel), getExecutor()); handler.getAttachments().attach(ManagementChannelHandler.TEMP_DIR, tempDir); // Assemble the request handlers for the domain channel handler.addHandlerFactory(new HostControllerRegistrationHandler(handler, domainController, operationExecutor, getExecutor(), slaveHostRegistrations, domainHostExcludeRegistry)); handler.addHandlerFactory(new ModelControllerClientOperationHandler(getController(), handler, getResponseAttachmentSupport(), getClientRequestExecutor())); handler.addHandlerFactory(new MasterDomainControllerOperationHandlerImpl(domainController, getExecutor())); handler.addHandlerFactory(pongRequestHandler); handler.addHandlerFactory(new DomainTransactionalProtocolOperationHandler(txOperationExecutor, handler, getResponseAttachmentSupport())); channel.receiveMessage(handler.getReceiver()); return handler; }
@Override public ManagementChannelHandler startReceiving(final Channel channel) { final ManagementChannelHandler handler = new ManagementChannelHandler(ManagementClientChannelStrategy.create(channel), getExecutor()); handler.getAttachments().attach(ManagementChannelHandler.TEMP_DIR, tempDir); // Assemble the request handlers for the domain channel handler.addHandlerFactory(new HostControllerRegistrationHandler(handler, domainController, operationExecutor, getExecutor(), slaveHostRegistrations, domainHostExcludeRegistry)); handler.addHandlerFactory(new ModelControllerClientOperationHandler(getController(), handler, getResponseAttachmentSupport(), getClientRequestExecutor())); handler.addHandlerFactory(new MasterDomainControllerOperationHandlerImpl(domainController, getExecutor())); handler.addHandlerFactory(pongRequestHandler); handler.addHandlerFactory(new DomainTransactionalProtocolOperationHandler(txOperationExecutor, handler, getResponseAttachmentSupport())); channel.receiveMessage(handler.getReceiver()); return handler; }
if (header.getVersion() != 1) { handler.getAttachments().attach(TransactionalProtocolClient.SEND_IDENTITY, Boolean.TRUE);
if (header.getVersion() != 1) { handler.getAttachments().attach(TransactionalProtocolClient.SEND_IDENTITY, Boolean.TRUE);
handler.getAttachments().attach(ManagementChannelHandler.TEMP_DIR, tempDir); } catch (Exception e) { throw new StartException(e);
handler.getAttachments().attach(ManagementChannelHandler.TEMP_DIR, tempDir); } catch (Exception e) { throw new StartException(e);