@Override public void unregisterRemoteHost(String id, Long remoteConnectionId) { HostRegistration hostRegistration = hostRegistrationMap.get(id); if (hostRegistration != null) { if ((remoteConnectionId == null || remoteConnectionId.equals(hostRegistration.remoteConnectionId)) && hostRegistrationMap.remove(id, hostRegistration)) { if (hostRegistration.pinger != null) { hostRegistration.pinger.cancel(); } hostProxies.remove(id); runtimeIgnoreTransformationRegistry.unregisterHost(id); modelNodeRegistration.unregisterProxyController(PathElement.pathElement(HOST, id)); DOMAIN_LOGGER.unregisteredRemoteSlaveHost(id); } } }
@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); // } }