@Override public void start() throws Exception { if (group == null) { throw new IOException("You must specify a group to discover"); } String type = getType(); if (!type.endsWith(".")) { LOG.warn("The type '{}' should end with '.' to be a valid Rendezvous type", type); type += "."; } try { // force lazy construction getJmdns(); if (listener != null) { LOG.info("Discovering service of type: {}", type); jmdns.addServiceListener(type, this); } } catch (IOException e) { JMSExceptionSupport.create("Failed to start JmDNS service: " + e, e); } }
@Override public void addServiceListener(String type, ServiceListener listener) { for (JmDNS instance : jmdnsInstances) { instance.addServiceListener(type, listener); } }
@Override public void addServiceListener(String type, ServiceListener listener) { for (JmDNS mDNS : _knownMDNS.values()) { mDNS.addServiceListener(type, listener); } }
@Override public void addServiceListener(String type, ServiceListener listener) { for (JmDNS mDNS : _knownMDNS.values()) { mDNS.addServiceListener(type, listener); } }
@Override public void addServiceListener(String type, ServiceListener listener) { for (JmDNS mDNS : _knownMDNS.values()) { mDNS.addServiceListener(type, listener); } }
@Override public void addServiceListener(String type, ServiceListener listener) { jmdnsInstances.values().forEach(jmdns -> jmdns.addServiceListener(type, listener)); }
@Override public void addServiceListener(String type, ServiceListener listener) { final String loType = type.toLowerCase(); List<ServiceListener> list = _serviceListeners.get(loType); if (list == null) { _serviceListeners.putIfAbsent(loType, new LinkedList<ServiceListener>()); list = _serviceListeners.get(loType); } if (list != null) { synchronized (list) { if (!list.contains(listener)) { list.add(listener); } } } for (JmDNS mDNS : this.getDNS()) { mDNS.addServiceListener(type, listener); } }
mDNS.addServiceListener(SERVICE_TYPE, mServiceListener); mIsDetecting = true;
@Override public void start() throws Exception { if (group == null) { throw new IOException("You must specify a group to discover"); } String type = getType(); if (!type.endsWith(".")) { LOG.warn("The type '{}' should end with '.' to be a valid Rendezvous type", type); type += "."; } try { // force lazy construction getJmdns(); if (listener != null) { LOG.info("Discovering service of type: {}", type); jmdns.addServiceListener(type, this); } } catch (IOException e) { JMSExceptionSupport.create("Failed to start JmDNS service: " + e, e); } }
@Override public void start() throws Exception { if (group == null) { throw new IOException("You must specify a group to discover"); } String type = getType(); if (!type.endsWith(".")) { LOG.warn("The type '{}' should end with '.' to be a valid Rendezvous type", type); type += "."; } try { // force lazy construction getJmdns(); if (listener != null) { LOG.info("Discovering service of type: {}", type); jmdns.addServiceListener(type, this); } } catch (IOException e) { JMSExceptionSupport.create("Failed to start JmDNS service: " + e, e); } }
JmDNS dns = JmDNS.create(); dns.addServiceListener("_exp._tcp.local.", new ServiceListenerImpl())); dns.list("_exp._tcp.local.", 10 * 1000);
jmDNS.addServiceListener(KNOWN_SERVICE_TYPES[i][0], instance);
@Override public void start() throws Exception { if (group == null) { throw new IOException("You must specify a group to discover"); } String type = getType(); if (!type.endsWith(".")) { LOG.warn("The type '{}' should end with '.' to be a valid Rendezvous type", type); type += "."; } try { // force lazy construction getJmdns(); if (listener != null) { LOG.info("Discovering service of type: {}", type); jmdns.addServiceListener(type, this); } } catch (IOException e) { JMSExceptionSupport.create("Failed to start JmDNS service: " + e, e); } }
@Override protected void startComponent() throws Exception { super.startComponent(); URL localEndpoint = getConfiguration().getBaseUrl(); InetAddress ip = InetAddress.getByName(localEndpoint.getHost()); m_jmDNS = JmDNS.create(ip, DISCOVERY_NAME); m_jmDNSListener = new JmDNSListener(); m_jmDNS.addServiceListener(SERVICE_TYPE, m_jmDNSListener); Map<String, Object> props = new HashMap<String, Object>(); props.put("path", localEndpoint.getPath()); ServiceInfo info = ServiceInfo.create(SERVICE_TYPE, DISCOVERY_NAME, localEndpoint.getPort(), 0, 0, props); m_jmDNS.registerService(info); }
addServiceListener(type, collector); newCollectorCreated = true;
synchronized (listeners) { for (ServiceListener listener : listeners) { dns.addServiceListener(type, listener);