private void startServers() { ModelNode addr = new ModelNode(); addr.add(HOST, hostControllerInfo.getLocalHostName()); ModelNode op = Util.getEmptyOperation(StartServersHandler.OPERATION_NAME, addr); getValue().execute(op, null, null, null); }
@Override public void unregisterRunningServer(String serverName) { PathAddress pa = PathAddress.pathAddress( PathElement.pathElement(HOST, hostControllerInfo.getLocalHostName())); PathElement pe = PathElement.pathElement(RUNNING_SERVER, serverName); ROOT_LOGGER.unregisteringServer(serverName); ManagementResourceRegistration hostRegistration = modelNodeRegistration.getSubModel(pa); hostRegistration.unregisterProxyController(pe); serverProxies.remove(serverName); }
@Override public void registerRemoteHost( final String hostName, final ManagementChannelHandler handler, final Transformers transformers, Long remoteConnectionId, DomainControllerRuntimeIgnoreTransformationEntry runtimeIgnoreTransformation) throws SlaveRegistrationException { if (!hostControllerInfo.isMasterDomainController()) { throw SlaveRegistrationException.forHostIsNotMaster(); } if (runningModeControl.getRunningMode() == RunningMode.ADMIN_ONLY) { throw SlaveRegistrationException.forMasterInAdminOnlyMode( runningModeControl.getRunningMode()); } final PathElement pe = PathElement.pathElement(ModelDescriptionConstants.HOST, hostName); final PathAddress addr = PathAddress.pathAddress(pe); ProxyController existingController = modelNodeRegistration.getProxyController(addr); if (existingController != null || hostControllerInfo.getLocalHostName().equals(pe.getValue())) { throw SlaveRegistrationException.forHostAlreadyExists(pe.getValue()); } SlaveHostPinger pinger = remoteConnectionId == null ? null : new SlaveHostPinger(hostName, handler, pingScheduler, remoteConnectionId); hostRegistrationMap.put(hostName, new HostRegistration(remoteConnectionId, handler, pinger)); // Create the proxy controller final TransformingProxyController hostControllerClient = TransformingProxyController.Factory.create( handler, transformers, addr, ProxyOperationAddressTranslator.HOST); modelNodeRegistration.registerProxyController(pe, hostControllerClient); runtimeIgnoreTransformationRegistry.registerHost(hostName, runtimeIgnoreTransformation); hostProxies.put(hostName, hostControllerClient); // if (pinger != null) { // pinger.schedulePing(SlaveHostPinger.STD_TIMEOUT, SlaveHostPinger.STD_INTERVAL); // } }
@Override public void registerRunningServer(final ProxyController serverControllerClient) { PathAddress pa = serverControllerClient.getProxyNodeAddress(); PathElement pe = pa.getElement(1); if (modelNodeRegistration.getProxyController(pa) != null) { throw MESSAGES.serverNameAlreadyRegistered(pe.getValue()); } ROOT_LOGGER.registeringServer(pe.getValue()); // Register the proxy final ManagementResourceRegistration hostRegistration = modelNodeRegistration.getSubModel( PathAddress.pathAddress( PathElement.pathElement(HOST, hostControllerInfo.getLocalHostName()))); hostRegistration.registerProxyController(pe, serverControllerClient); // Register local operation overrides final ManagementResourceRegistration serverRegistration = hostRegistration.getSubModel(PathAddress.EMPTY_ADDRESS.append(pe)); ServerConfigResourceDefinition.registerServerLifecycleOperations( serverRegistration, serverInventory); serverProxies.put(pe.getValue(), serverControllerClient); }
@Override public void registerRemoteHost(ProxyController hostControllerClient) throws SlaveRegistrationException { if (!hostControllerInfo.isMasterDomainController()) { throw SlaveRegistrationException.forHostIsNotMaster(); } if (runningModeControl.getRunningMode() == RunningMode.ADMIN_ONLY) { throw SlaveRegistrationException.forMasterInAdminOnlyMode( runningModeControl.getRunningMode()); } PathAddress pa = hostControllerClient.getProxyNodeAddress(); PathElement pe = pa.getElement(0); ProxyController existingController = modelNodeRegistration.getProxyController(pa); if (existingController != null || hostControllerInfo.getLocalHostName().equals(pe.getValue())) { throw SlaveRegistrationException.forHostAlreadyExists(pe.getValue()); } modelNodeRegistration.registerProxyController(pe, hostControllerClient); hostProxies.put(pe.getValue(), hostControllerClient); Logger.getLogger("org.jboss.domain").info("Registered remote slave host " + pe.getValue()); }
@Override public boolean isHostRegistered(String id) { return hostControllerInfo.getLocalHostName().equals(id) || hostRegistrationMap.containsKey(id); }
// See superclass start. This method is invoked from a separate non-MSC thread after start. So we // can do a fair // bit of stuff @Override protected void boot(final BootContext context) throws ConfigurationPersistenceException { final ServiceTarget serviceTarget = context.getServiceTarget(); try { super.boot( hostControllerConfigurationPersister .load()); // This parses the host.xml and invokes all ops final RunningMode currentRunningMode = runningModeControl.getRunningMode(); // Now we know our management interface configuration. Install the server inventory Future<ServerInventory> inventoryFuture = ServerInventoryService.install( serviceTarget, this, environment, hostControllerInfo.getNativeManagementInterface(), hostControllerInfo.getNativeManagementPort()); // Install the core remoting endpoint and listener ManagementRemotingServices.installRemotingEndpoint( serviceTarget, ManagementRemotingServices.MANAGEMENT_ENDPOINT, hostControllerInfo.getLocalHostName(), EndpointService.EndpointType.MANAGEMENT, null, null); if (!hostControllerInfo.isMasterDomainController() && !environment.isUseCachedDc()) { serverInventory = getFuture(inventoryFuture); if (hostControllerInfo.getRemoteDomainControllerHost() != null) { Future<MasterDomainControllerClient> clientFuture = RemoteDomainConnectionService.install( serviceTarget, getValue(), hostControllerInfo.getLocalHostName(), hostControllerInfo.getRemoteDomainControllerHost(), hostControllerInfo.getRemoteDomainControllertPort(), hostControllerInfo.getRemoteDomainControllerSecurityRealm(), remoteFileRepository); MasterDomainControllerClient masterDomainControllerClient = getFuture(clientFuture); // Registers us with the master and gets down the master copy of the domain model to our // DC // TODO make sure that the RDCS checks env.isUseCachedDC, and if true falls through to // that try { masterDomainControllerClient.register(); } catch (IllegalStateException e) { // We could not connect to the host log.error(HostControllerMessages.MESSAGES.cannotConnectToMaster(e)); System.exit(ExitCodes.HOST_CONTROLLER_ABORT_EXIT_CODE); } } else if (currentRunningMode != RunningMode.ADMIN_ONLY) { // We could not connect to the host log.error( HostControllerMessages.MESSAGES.noDomainControllerConfigurationProvided( currentRunningMode, CommandLineConstants.ADMIN_ONLY, RunningMode.ADMIN_ONLY)); System.exit(ExitCodes.HOST_CONTROLLER_ABORT_EXIT_CODE); } } else { // TODO look at having LocalDomainControllerAdd do this, using Stage.IMMEDIATE for the steps // parse the domain.xml and load the steps ConfigurationPersister domainPersister = hostControllerConfigurationPersister.getDomainPersister(); super.boot(domainPersister.load()); ManagementRemotingServices.installManagementChannelServices( serviceTarget, ManagementRemotingServices.MANAGEMENT_ENDPOINT, new MasterDomainControllerOperationHandlerService(this, this), DomainModelControllerService.SERVICE_NAME, ManagementRemotingServices.DOMAIN_CHANNEL, null, null); serverInventory = getFuture(inventoryFuture); } // TODO look into adding some of these services in the handlers, but ON-DEMAND. // Then here just add some simple service that demands them ServerToHostOperationHandlerFactoryService.install( serviceTarget, ServerInventoryService.SERVICE_NAME, proxyExecutor); NativeManagementAddHandler.installNativeManagementServices( serviceTarget, hostControllerInfo, null, null); if (hostControllerInfo.getHttpManagementInterface() != null) { HttpManagementAddHandler.installHttpManagementServices( serviceTarget, hostControllerInfo, environment, null); } if (currentRunningMode == RunningMode.NORMAL) { startServers(); } // TODO when to call hostControllerConfigurationPersister.successful boot? Look into this for // standalone as well; may be broken now } finally { try { finishBoot(); } finally { bootstrapListener.tick(); } } }