Class JmDNSImpl.ServiceCollector

java.lang.Object
javax.jmdns.impl.JmDNSImpl.ServiceCollector
All Implemented Interfaces:
EventListener, ServiceListener
Enclosing class:
JmDNSImpl

private static class JmDNSImpl.ServiceCollector extends Object implements ServiceListener
Instances of ServiceCollector are used internally to speed up the performance of method list(type).
See Also:
  • Field Details

    • _infos

      private final ConcurrentMap<String,ServiceInfo> _infos
      A set of collected service instance names.
    • _events

      private final ConcurrentMap<String,ServiceEvent> _events
      A set of collected service event waiting to be resolved.
    • _type

      private final String _type
      This is the type we are listening for (only used for debugging).
    • _needToWaitForInfos

      private volatile boolean _needToWaitForInfos
      This is used to force a wait on the first invocation of list.
  • Constructor Details

    • ServiceCollector

      public ServiceCollector(String type)
  • Method Details

    • serviceAdded

      public void serviceAdded(ServiceEvent event)
      A service has been added.
      Specified by:
      serviceAdded in interface ServiceListener
      Parameters:
      event - service event
    • serviceRemoved

      public void serviceRemoved(ServiceEvent event)
      A service has been removed.
      Specified by:
      serviceRemoved in interface ServiceListener
      Parameters:
      event - service event
    • serviceResolved

      public void serviceResolved(ServiceEvent event)
      A service has been resolved. Its details are now available in the ServiceInfo record.
      Specified by:
      serviceResolved in interface ServiceListener
      Parameters:
      event - service event
    • list

      public ServiceInfo[] list(long timeout)
      Returns an array of all service infos which have been collected by this ServiceCollector.
      Parameters:
      timeout - timeout if the info list is empty.
      Returns:
      Service Info array
    • toString

      public String toString()
      Overrides:
      toString in class Object