/** * {@inheritDoc} */ @Override public void registerService(ServiceInfo infoAbstract) throws IOException { if (this.isClosing() || this.isClosed()) { throw new IllegalStateException("This DNS is closed."); } final ServiceInfoImpl info = (ServiceInfoImpl) infoAbstract; if (info.getDns() != null) { if (info.getDns() != this) { throw new IllegalStateException("A service information can only be registered with a single instamce of JmDNS."); } else if (_services.get(info.getKey()) != null) { throw new IllegalStateException("A service information can only be registered once."); } } info.setDns(this); this.registerServiceType(info.getTypeWithSubtype()); // bind the service to this address info.recoverState(); info.setServer(_localHost.getName()); info.addAddress(_localHost.getInet4Address()); info.addAddress(_localHost.getInet6Address()); this.makeServiceNameUnique(info); while (_services.putIfAbsent(info.getKey(), info) != null) { this.makeServiceNameUnique(info); } this.startProber(); logger.debug("registerService() JmDNS registered service as {}", info); }
info.setServer(_localHost.getName()); info.addAddress(_localHost.getInet4Address()); info.addAddress(_localHost.getInet6Address());
info.setServer(_localHost.getName()); info.addAddress(_localHost.getInet4Address()); info.addAddress(_localHost.getInet6Address());
/** * {@inheritDoc} */ @Override public void registerService(ServiceInfo infoAbstract) throws IOException { if (this.isClosing() || this.isClosed()) { throw new IllegalStateException("This DNS is closed."); } final ServiceInfoImpl info = (ServiceInfoImpl) infoAbstract; if ((info.getDns() != null) && (info.getDns() != this)) { throw new IllegalStateException("This service information is already registered with another DNS."); } info.setDns(this); this.registerServiceType(info.getTypeWithSubtype()); // bind the service to this address info.setServer(_localHost.getName()); info.addAddress(_localHost.getInet4Address()); info.addAddress(_localHost.getInet6Address()); this.waitForAnnounced(DNSConstants.SERVICE_INFO_TIMEOUT); this.makeServiceNameUnique(info); while (_services.putIfAbsent(info.getKey(), info) != null) { this.makeServiceNameUnique(info); } this.startProber(); info.waitForAnnounced(DNSConstants.SERVICE_INFO_TIMEOUT); if (logger.isLoggable(Level.FINE)) { logger.fine("registerService() JmDNS registered service as " + info); } }