SlaveHostPinger pinger = remoteConnectionId == null ? null : new SlaveHostPinger(hostName, handler, pingScheduler, remoteConnectionId); hostRegistrationMap.put(hostName, new HostRegistration(remoteConnectionId, handler, pinger));
@Override public void registerRemoteHost(final String hostName, final ManagementChannelHandler handler, final Transformers transformers, final Long remoteConnectionId, final boolean registerProxyController) 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()); } final SlaveHostPinger pinger = remoteConnectionId == null ? null : new SlaveHostPinger(hostName, handler, pingScheduler, remoteConnectionId); final String address = handler.getRemoteAddress().getHostAddress(); slaveHostRegistrations.registerHost(hostName, pinger, address); if (registerProxyController) { // Create the proxy controller final TransformingProxyController hostControllerClient = TransformingProxyController.Factory.create(handler, transformers, addr, ProxyOperationAddressTranslator.HOST); modelNodeRegistration.registerProxyController(pe, hostControllerClient); hostProxies.put(hostName, hostControllerClient); } }
@Override public void registerRemoteHost(final String hostName, final ManagementChannelHandler handler, final Transformers transformers, final Long remoteConnectionId, final boolean registerProxyController) 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()); } final SlaveHostPinger pinger = remoteConnectionId == null ? null : new SlaveHostPinger(hostName, handler, pingScheduler, remoteConnectionId); final String address = handler.getRemoteAddress().getHostAddress(); slaveHostRegistrations.registerHost(hostName, pinger, address); if (registerProxyController) { // Create the proxy controller final TransformingProxyController hostControllerClient = TransformingProxyController.Factory.create(handler, transformers, addr, ProxyOperationAddressTranslator.HOST); modelNodeRegistration.registerProxyController(pe, hostControllerClient); hostProxies.put(hostName, hostControllerClient); } }