/** * Get service information. If the information is not cached, the method * will block until updated information is received. * <p/> * Usage note: Do not call this method from the AWT event dispatcher thread. * You will make the user interface unresponsive. * * @param type fully qualified service type, such as <code>_http._tcp.local.</code> . * @param name unqualified service name, such as <code>foobar</code> . * @return null if the service information cannot be obtained */ public ServiceInfo getServiceInfo(String type, String name) { return getServiceInfo(type, name, 3 * 1000); }
@Override public ServiceInfo call() throws Exception { return mDNS.getServiceInfo(type, name, persistent, timeout); }
/** * {@inheritDoc} */ @Override public void run() { result.add(mDNS.getServiceInfo(type, name, persistent, timeout)); } });
/** * {@inheritDoc} */ @Override public void run() { result.add(mDNS.getServiceInfo(type, name, persistent, timeout)); } });
/** * {@inheritDoc} */ @Override public void run() { result.add(mDNS.getServiceInfo(type, name, persistent, timeout)); } });
public static void unregisterService(McmDNSServiceInfo serviceInfo) { if (isServiceStopped.get() || getJmDNSservice() == null) { return; } if (getJmDNSservice().getServiceInfo(serviceInfo.getType(), serviceInfo.getName()) != null) { getJmDNSservice().unregisterService(getServiceInfo(serviceInfo)); _logger.info("Unregistered a mDNS service {}", serviceInfo); } }
public void serviceRemoved(ServiceEvent serviceEvent) { LOGGER.trace("name="+serviceEvent.getName()+" type="+serviceEvent.getType()); // Ignore if Bonjour has been disabled if(!isActive()) return; // Looks for an existing BonjourService instance corresponding to the service being removed and removes it from // the list of current Bonjour services. // ServiceInfo should be available in JmDNS's cache. ServiceInfo serviceInfo = jmDNS.getServiceInfo(serviceEvent.getType(), serviceEvent.getName()); if(serviceInfo!=null) { if(serviceInfo.getInetAddress() instanceof Inet6Address) { // IPv6 addresses not supported at this time + they seem not to be correctly handled by ServiceInfo LOGGER.debug("ignoring IPv6 service"); return; } BonjourService bs = createBonjourService(serviceInfo); // Synchronized to properly handle duplicate calls synchronized(instance) { // Note: BonjourService#equals() uses the service's fully qualified name as the discriminator. if(bs!=null && services.contains(bs)) { LOGGER.debug("BonjourService "+bs+" removed"); services.remove(bs); } } } } }
public static void unregisterService(McmDNSServiceInfo serviceInfo) { if (isServiceStopped.get() || getJmDNSservice() == null) { return; } if (getJmDNSservice().getServiceInfo(serviceInfo.getType(), serviceInfo.getName()) != null) { getJmDNSservice().unregisterService(getServiceInfo(serviceInfo)); _logger.info("Unregistered a mDNS service {}", serviceInfo); } }