/** * During recovery we need to duplicate service info to reregister them * * @param info */ ServiceInfoImpl(ServiceInfo info) { this._ipv4Addresses = Collections.synchronizedSet(new LinkedHashSet<Inet4Address>()); this._ipv6Addresses = Collections.synchronizedSet(new LinkedHashSet<Inet6Address>()); if (info != null) { this._domain = info.getDomain(); this._protocol = info.getProtocol(); this._application = info.getApplication(); this._name = info.getName(); this._subtype = info.getSubtype(); this._port = info.getPort(); this._weight = info.getWeight(); this._priority = info.getPriority(); this._text = info.getTextBytes(); this._persistent = info.isPersistent(); Inet6Address[] ipv6Addresses = info.getInet6Addresses(); for (Inet6Address address : ipv6Addresses) { this._ipv6Addresses.add(address); } Inet4Address[] ipv4Addresses = info.getInet4Addresses(); for (Inet4Address address : ipv4Addresses) { this._ipv4Addresses.add(address); } } this._state = new ServiceInfoState(this); }
@Override public void serviceResolved(ServiceEvent serviceEvent) { ServiceInfo info = serviceEvent.getInfo(); for (InetAddress inetAddress : info.getInet4Addresses()) { bonour newItem = new bonour(); newItem.address = inetAddress.getHostAddress(); newItem.name = serviceEvent.getName(); if (info.hasData()) { newItem.board = info.getPropertyString("board"); // $NON-NLS-1$ newItem.distroversion = info.getPropertyString("distro_version"); // $NON-NLS-1$ newItem.name = info.getServer(); } while (newItem.name.endsWith(".")) { // $NON-NLS-1$ newItem.name = newItem.name.substring(0, newItem.name.length() - 1); } newItem.port = Integer.toString(info.getPort()); synchronized (this) { removeBoardswithSameAdress(newItem); this.myComPorts.add(newItem); } } }