JmDNSImpl
Date: 2017-02-10

javax.jmdns.impl

## Class JmDNSImpl

- java.lang.Object
- - javax.jmdns.JmDNS
  - - javax.jmdns.impl.JmDNSImpl

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, DNSStatefulObject, DNSTaskStarter

      public class JmDNSImpl
      extends JmDNS
      implements DNSStatefulObject, DNSTaskStarter

  mDNS implementation in Java.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `JmDNSImpl.Operation`
    `static class` | `JmDNSImpl.ServiceTypeEntry` This is used to store type entries.
    `protected class` | `JmDNSImpl.Shutdown` Shutdown operations.

    - ### Nested classes/interfaces inherited from class javax.jmdns.JmDNS

      `JmDNS.Delegate`

    - ### Nested classes/interfaces inherited from interface javax.jmdns.impl.DNSStatefulObject

      `DNSStatefulObject.DefaultImplementation, DNSStatefulObject.DNSStatefulObjectSemaphore`

    - ### Nested classes/interfaces inherited from interface javax.jmdns.impl.DNSTaskStarter

      `DNSTaskStarter.DNSTaskStarterImpl, DNSTaskStarter.Factory`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.Thread` | `_shutdown` This is the shutdown hook, we registered with the java runtime.

    - ### Fields inherited from class javax.jmdns.JmDNS

      `VERSION`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JmDNSImpl(java.net.InetAddress address, java.lang.String name)` Create an instance of JmDNS and bind it to a specific network interface given its IP-address.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `DNSOutgoing` | `addAnswer(DNSIncoming in, java.net.InetAddress addr, int port, DNSOutgoing out, DNSRecord rec)` Add an answer to a question.
    `void` | `addListener(javax.jmdns.impl.DNSListener listener, DNSQuestion question)` Add a listener for a question.
    `void` | `addServiceListener(java.lang.String type, ServiceListener listener)` Listen for services of a given type.
    `void` | `addServiceTypeListener(ServiceTypeListener listener)` Listen for service types.
    `boolean` | `advanceState(DNSTask task)` Sets the state and notifies all objects that wait on the ServiceInfo.
    `void` | `associateWithTask(DNSTask task, DNSState state)` Sets the task associated with this Object.
    `boolean` | `cancelState()` Sets the state and notifies all objects that wait on the ServiceInfo.
    `void` | `cancelStateTimer()` Cancel the state task timer
    `void` | `cancelTimer()` Cancel the generals task timer
    `void` | `cleanCache()`
    `void` | `close()`
    `boolean` | `closeState()` Sets the state and notifies all objects that wait on the ServiceInfo.
    `DNSCache` | `getCache()` Return the DNSCache associated with the cache variable
    `JmDNS.Delegate` | `getDelegate()` Returns the instance delegate
    `JmDNSImpl` | `getDns()` Returns the DNS associated with this object.
    `java.net.InetAddress` | `getGroup()`
    `java.lang.String` | `getHostName()` Return the HostName associated with this JmDNS instance.
    `java.net.InetAddress` | `getInterface()` Return the address of the interface to which this instance of JmDNS is bound.
    `long` | `getLastThrottleIncrement()`
    `HostInfo` | `getLocalHost()` Returns the local host info
    `java.lang.String` | `getName()` Return the name of the JmDNS instance.
    `DNSIncoming` | `getPlannedAnswer()`
    `static java.util.Random` | `getRandom()`
    `ServiceInfo` | `getServiceInfo(java.lang.String type, java.lang.String name)` Get service information.
    `ServiceInfo` | `getServiceInfo(java.lang.String type, java.lang.String name, boolean persistent)` Get service information.
    `ServiceInfo` | `getServiceInfo(java.lang.String type, java.lang.String name, boolean persistent, long timeout)` Get service information.
    `ServiceInfo` | `getServiceInfo(java.lang.String type, java.lang.String name, long timeout)` Get service information.
    `java.util.Map<java.lang.String,ServiceInfo>` | `getServices()`
    `java.util.Map<java.lang.String,JmDNSImpl.ServiceTypeEntry>` | `getServiceTypes()`
    `java.net.MulticastSocket` | `getSocket()`
    `int` | `getThrottle()`
    `void` | `ioLock()`
    `void` | `ioUnlock()`
    `boolean` | `isAnnounced()` Returns true, if this is an announced state.
    `boolean` | `isAnnouncing()` Returns true, if this is an announcing state.
    `boolean` | `isAssociatedWithTask(DNSTask task, DNSState state)` Checks if this object is associated with the task and in the same state.
    `boolean` | `isCanceled()` Returns true, if this is a canceled state.
    `boolean` | `isCanceling()` Returns true, if this is a canceling state.
    `boolean` | `isClosed()` Returns true, if this is a closed state.
    `boolean` | `isClosing()` Returns true, if this is a closing state.
    `boolean` | `isProbing()` Returns true, if this is a probing state.
    `ServiceInfo[]` | `list(java.lang.String type)` Returns a list of service infos of the specified type.
    `ServiceInfo[]` | `list(java.lang.String type, long timeout)` Returns a list of service infos of the specified type.
    `java.util.Map<java.lang.String,ServiceInfo[]>` | `listBySubtype(java.lang.String type)` Returns a list of service infos of the specified type sorted by subtype.
    `java.util.Map<java.lang.String,ServiceInfo[]>` | `listBySubtype(java.lang.String type, long timeout)` Returns a list of service infos of the specified type sorted by subtype.
    `static void` | `main(java.lang.String[] argv)` Main method to display API information if run from java -jar
    `void` | `printServices()` Deprecated.
    `void` | `purgeStateTimer()` Purge the state task timer
    `void` | `purgeTimer()` Purge the general task timer
    `void` | `recover()` Recover jmdns when there is an error.
    `boolean` | `recoverState()` Sets the state and notifies all objects that wait on the ServiceInfo.
    `void` | `registerService(ServiceInfo infoAbstract)` Register a service.
    `boolean` | `registerServiceType(java.lang.String type)` Register a service type.
    `void` | `removeAssociationWithTask(DNSTask task)` Remove the association of the task with this Object.
    `void` | `removeListener(javax.jmdns.impl.DNSListener listener)` Remove a listener from all outstanding questions.
    `void` | `removeServiceListener(java.lang.String type, ServiceListener listener)` Remove listener for services of a given type.
    `void` | `removeServiceTypeListener(ServiceTypeListener listener)` Remove listener for service types.
    `void` | `renewServiceCollector(DNSRecord record)` Renew a service when the record become stale.
    `void` | `requestServiceInfo(java.lang.String type, java.lang.String name)` Request service information.
    `void` | `requestServiceInfo(java.lang.String type, java.lang.String name, boolean persistent)` Request service information.
    `void` | `requestServiceInfo(java.lang.String type, java.lang.String name, boolean persistent, long timeout)` Request service information.
    `void` | `requestServiceInfo(java.lang.String type, java.lang.String name, long timeout)` Request service information.
    `void` | `respondToQuery(DNSIncoming in)`
    `boolean` | `revertState()` Sets the state and notifies all objects that wait on the ServiceInfo.
    `void` | `send(DNSOutgoing out)` Send an outgoing multicast DNS message.
    `JmDNS.Delegate` | `setDelegate(JmDNS.Delegate delegate)` Sets the instance delegate
    `void` | `setLastThrottleIncrement(long lastThrottleIncrement)`
    `void` | `setPlannedAnswer(DNSIncoming plannedAnswer)`
    `void` | `setThrottle(int throttle)`
    `void` | `startAnnouncer()` Start a new announcer task
    `void` | `startCanceler()` Start a new canceler task
    `void` | `startProber()` Start a new prober task
    `void` | `startReaper()` Start a new reaper task.
    `void` | `startRenewer()` Start a new renewer task
    `void` | `startResponder(DNSIncoming in, int port)` Start a new responder task
    `void` | `startServiceInfoResolver(ServiceInfoImpl info)` Start a new service info resolver task
    `void` | `startServiceResolver(java.lang.String type)` Start a new service resolver task
    `void` | `startTypeResolver()` Start a new service type resolver task
    `java.lang.String` | `toString()`
    `void` | `unregisterAllServices()` Unregister all services.
    `void` | `unregisterService(ServiceInfo infoAbstract)` Unregister a service.
    `void` | `updateRecord(long now, DNSRecord rec, JmDNSImpl.Operation operation)` Notify all listeners that a record was updated.
    `boolean` | `waitForAnnounced(long timeout)` Waits for the object to be announced.
    `boolean` | `waitForCanceled(long timeout)` Waits for the object to be canceled.

    - ### Methods inherited from class javax.jmdns.JmDNS

      `create, create, create, create`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### _shutdown

          protected java.lang.Thread _shutdown

      This is the shutdown hook, we registered with the java runtime.

  - ### Constructor Detail

    - #### JmDNSImpl

          public JmDNSImpl(java.net.InetAddress address,
                   java.lang.String name)
                    throws java.io.IOException

      Create an instance of JmDNS and bind it to a specific network interface given its IP-address.
      Parameters:
        `address` - IP address to bind to.
        `name` - name of the newly created JmDNS
      Throws:
        `java.io.IOException`

  - ### Method Detail

    - #### main

          public static void main(java.lang.String[] argv)

      Main method to display API information if run from java -jar
      Parameters:
        `argv` - the command line arguments

    - #### advanceState

          public boolean advanceState(DNSTask task)

      Sets the state and notifies all objects that wait on the ServiceInfo.
      Specified by:
        `advanceState` in interface `DNSStatefulObject`
      Parameters:
        `task` - associated task
      Returns:
        `true`false otherwise.
      See Also:
        `DNSState.advance()`

    - #### revertState

          public boolean revertState()

      Sets the state and notifies all objects that wait on the ServiceInfo.
      Specified by:
        `revertState` in interface `DNSStatefulObject`
      Returns:
        `true`false otherwise.
      See Also:
        `DNSState.revert()`

    - #### cancelState

          public boolean cancelState()

      Sets the state and notifies all objects that wait on the ServiceInfo.
      Specified by:
        `cancelState` in interface `DNSStatefulObject`
      Returns:
        `true`false otherwise.

    - #### closeState

          public boolean closeState()

      Sets the state and notifies all objects that wait on the ServiceInfo.
      Specified by:
        `closeState` in interface `DNSStatefulObject`
      Returns:
        `true`false otherwise.

    - #### recoverState

          public boolean recoverState()

      Sets the state and notifies all objects that wait on the ServiceInfo.
      Specified by:
        `recoverState` in interface `DNSStatefulObject`
      Returns:
        `true`false otherwise.

    - #### getDns

          public JmDNSImpl getDns()

      Returns the DNS associated with this object.
      Specified by:
        `getDns` in interface `DNSStatefulObject`
      Returns:
        DNS resolver

    - #### associateWithTask

          public void associateWithTask(DNSTask task,
                               DNSState state)

      Sets the task associated with this Object.
      Specified by:
        `associateWithTask` in interface `DNSStatefulObject`
      Parameters:
        `task` - associated task
        `state` - state of the task

    - #### removeAssociationWithTask

          public void removeAssociationWithTask(DNSTask task)

      Remove the association of the task with this Object.
      Specified by:
        `removeAssociationWithTask` in interface `DNSStatefulObject`
      Parameters:
        `task` - associated task

    - #### isAssociatedWithTask

          public boolean isAssociatedWithTask(DNSTask task,
                                     DNSState state)

      Checks if this object is associated with the task and in the same state.
      Specified by:
        `isAssociatedWithTask` in interface `DNSStatefulObject`
      Parameters:
        `task` - associated task
        `state` - state of the task
      Returns:
        `true` is the task is associated with this object, `false` otherwise.

    - #### isProbing

          public boolean isProbing()

      Returns true, if this is a probing state.
      Specified by:
        `isProbing` in interface `DNSStatefulObject`
      Returns:
        `true` if probing state, `false` otherwise

    - #### isAnnouncing

          public boolean isAnnouncing()

      Returns true, if this is an announcing state.
      Specified by:
        `isAnnouncing` in interface `DNSStatefulObject`
      Returns:
        `true` if announcing state, `false` otherwise

    - #### isAnnounced

          public boolean isAnnounced()

      Returns true, if this is an announced state.
      Specified by:
        `isAnnounced` in interface `DNSStatefulObject`
      Returns:
        `true` if announced state, `false` otherwise

    - #### isCanceling

          public boolean isCanceling()

      Returns true, if this is a canceling state.
      Specified by:
        `isCanceling` in interface `DNSStatefulObject`
      Returns:
        `true` if canceling state, `false` otherwise

    - #### isCanceled

          public boolean isCanceled()

      Returns true, if this is a canceled state.
      Specified by:
        `isCanceled` in interface `DNSStatefulObject`
      Returns:
        `true` if canceled state, `false` otherwise

    - #### isClosing

          public boolean isClosing()

      Returns true, if this is a closing state.
      Specified by:
        `isClosing` in interface `DNSStatefulObject`
      Returns:
        `true` if closing state, `false` otherwise

    - #### isClosed

          public boolean isClosed()

      Returns true, if this is a closed state.
      Specified by:
        `isClosed` in interface `DNSStatefulObject`
      Returns:
        `true` if closed state, `false` otherwise

    - #### waitForAnnounced

          public boolean waitForAnnounced(long timeout)

      Waits for the object to be announced.
      Specified by:
        `waitForAnnounced` in interface `DNSStatefulObject`
      Parameters:
        `timeout` - the maximum time to wait in milliseconds.
      Returns:
        `true` if the object is announced, `false` otherwise

    - #### waitForCanceled

          public boolean waitForCanceled(long timeout)

      Waits for the object to be canceled.
      Specified by:
        `waitForCanceled` in interface `DNSStatefulObject`
      Parameters:
        `timeout` - the maximum time to wait in milliseconds.
      Returns:
        `true` if the object is canceled, `false` otherwise

    - #### getCache

          public DNSCache getCache()

      Return the DNSCache associated with the cache variable
      Returns:
        DNS cache

    - #### getName

          public java.lang.String getName()

      Return the name of the JmDNS instance. This is an arbitrary string that is useful for distinguishing instances.
      Specified by:
        `getName` in class `JmDNS`
      Returns:
        name of the JmDNS

    - #### getHostName

          public java.lang.String getHostName()

      Return the HostName associated with this JmDNS instance. Note: May not be the same as what started. The host name is subject to negotiation.
      Specified by:
        `getHostName` in class `JmDNS`
      Returns:
        Host name

    - #### getLocalHost

          public HostInfo getLocalHost()

      Returns the local host info
      Returns:
        local host info

    - #### getInterface

          public java.net.InetAddress getInterface()
                                            throws java.io.IOException

      Return the address of the interface to which this instance of JmDNS is bound.
      Specified by:
        `getInterface` in class `JmDNS`
      Returns:
        Internet Address
      Throws:
        `java.io.IOException` - if there is an error in the underlying protocol, such as a TCP error.

    - #### getServiceInfo

          public ServiceInfo getServiceInfo(java.lang.String type,
                                   java.lang.String name)

      Get service information. If the information is not cached, the method will block until updated information is received.

      Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.
      Specified by:
        `getServiceInfo` in class `JmDNS`
      Parameters:
        `type` - fully qualified service type, such as `_http._tcp.local.` .
        `name` - unqualified service name, such as `foobar` .
      Returns:
        null if the service information cannot be obtained

    - #### getServiceInfo

          public ServiceInfo getServiceInfo(java.lang.String type,
                                   java.lang.String name,
                                   long timeout)

      Get service information. If the information is not cached, the method will block for the given timeout until updated information is received.

      Usage note: If you call this method from the AWT event dispatcher thread, use a small timeout, or you will make the user interface unresponsive.
      Specified by:
        `getServiceInfo` in class `JmDNS`
      Parameters:
        `type` - full qualified service type, such as `_http._tcp.local.` .
        `name` - unqualified service name, such as `foobar` .
        `timeout` - timeout in milliseconds. Typical timeout should be 5s.
      Returns:
        null if the service information cannot be obtained

    - #### getServiceInfo

          public ServiceInfo getServiceInfo(java.lang.String type,
                                   java.lang.String name,
                                   boolean persistent)

      Get service information. If the information is not cached, the method will block until updated information is received.

      Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.
      Specified by:
        `getServiceInfo` in class `JmDNS`
      Parameters:
        `type` - fully qualified service type, such as `_http._tcp.local.` .
        `name` - unqualified service name, such as `foobar` .
        `persistent` - if `true` ServiceListener.resolveService will be called whenever new new information is received.
      Returns:
        null if the service information cannot be obtained

    - #### getServiceInfo

          public ServiceInfo getServiceInfo(java.lang.String type,
                                   java.lang.String name,
                                   boolean persistent,
                                   long timeout)

      Get service information. If the information is not cached, the method will block for the given timeout until updated information is received.

      Usage note: If you call this method from the AWT event dispatcher thread, use a small timeout, or you will make the user interface unresponsive.
      Specified by:
        `getServiceInfo` in class `JmDNS`
      Parameters:
        `type` - full qualified service type, such as `_http._tcp.local.` .
        `name` - unqualified service name, such as `foobar` .
        `persistent` - if `true` ServiceListener.resolveService will be called whenever new new information is received.
        `timeout` - timeout in milliseconds. Typical timeout should be 5s.
      Returns:
        null if the service information cannot be obtained

    - #### requestServiceInfo

          public void requestServiceInfo(java.lang.String type,
                                java.lang.String name)

      Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.

      Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.
      Specified by:
        `requestServiceInfo` in class `JmDNS`
      Parameters:
        `type` - full qualified service type, such as `_http._tcp.local.` .
        `name` - unqualified service name, such as `foobar` .

    - #### requestServiceInfo

          public void requestServiceInfo(java.lang.String type,
                                java.lang.String name,
                                boolean persistent)

      Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.

      Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.
      Specified by:
        `requestServiceInfo` in class `JmDNS`
      Parameters:
        `type` - full qualified service type, such as `_http._tcp.local.` .
        `name` - unqualified service name, such as `foobar` .
        `persistent` - if `true` ServiceListener.resolveService will be called whenever new new information is received.

    - #### requestServiceInfo

          public void requestServiceInfo(java.lang.String type,
                                java.lang.String name,
                                long timeout)

      Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.
      Specified by:
        `requestServiceInfo` in class `JmDNS`
      Parameters:
        `type` - full qualified service type, such as `_http._tcp.local.` .
        `name` - unqualified service name, such as `foobar` .
        `timeout` - timeout in milliseconds

    - #### requestServiceInfo

          public void requestServiceInfo(java.lang.String type,
                                java.lang.String name,
                                boolean persistent,
                                long timeout)

      Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.
      Specified by:
        `requestServiceInfo` in class `JmDNS`
      Parameters:
        `type` - full qualified service type, such as `_http._tcp.local.` .
        `name` - unqualified service name, such as `foobar` .
        `persistent` - if `true` ServiceListener.resolveService will be called whenever new new information is received.
        `timeout` - timeout in milliseconds

    - #### addServiceTypeListener

          public void addServiceTypeListener(ServiceTypeListener listener)
                                      throws java.io.IOException

      Listen for service types.
      Specified by:
        `addServiceTypeListener` in class `JmDNS`
      Parameters:
        `listener` - listener for service types
      Throws:
        `java.io.IOException` - if there is an error in the underlying protocol, such as a TCP error.

    - #### removeServiceTypeListener

          public void removeServiceTypeListener(ServiceTypeListener listener)

      Remove listener for service types.
      Specified by:
        `removeServiceTypeListener` in class `JmDNS`
      Parameters:
        `listener` - listener for service types

    - #### addServiceListener

          public void addServiceListener(java.lang.String type,
                                ServiceListener listener)

      Listen for services of a given type. The type has to be a fully qualified type name such as `_http._tcp.local.`.
      Specified by:
        `addServiceListener` in class `JmDNS`
      Parameters:
        `type` - full qualified service type, such as `_http._tcp.local.`.
        `listener` - listener for service updates

    - #### removeServiceListener

          public void removeServiceListener(java.lang.String type,
                                   ServiceListener listener)

      Remove listener for services of a given type.
      Specified by:
        `removeServiceListener` in class `JmDNS`
      Parameters:
        `type` - full qualified service type, such as `_http._tcp.local.`.
        `listener` - listener for service updates

    - #### registerService

          public void registerService(ServiceInfo infoAbstract)
                               throws java.io.IOException

      Register a service. The service is registered for access by other jmdns clients. The name of the service may be changed to make it unique.
      Note that the given `ServiceInfo` is bound to this `JmDNS` instance, and should not be reused for any other JmDNS.registerService(ServiceInfo).
      Specified by:
        `registerService` in class `JmDNS`
      Parameters:
        `infoAbstract` - service info to register
      Throws:
        `java.io.IOException` - if there is an error in the underlying protocol, such as a TCP error.

    - #### unregisterService

          public void unregisterService(ServiceInfo infoAbstract)

      Unregister a service. The service should have been registered.

      Note: Unregistered services will not disappear form the list of services immediately. According to the specification, when unregistering services we send goodbye packets and then wait 1s before purging the cache.
      This is support for shared records that can be rescued by some other cooperation DNS.

           Clients receiving a Multicast DNS Response with a TTL of zero SHOULD NOT immediately delete the record from the cache, but instead record a TTL of 1 and then delete the record one second later.

      Specified by:
        `unregisterService` in class `JmDNS`
      Parameters:
        `infoAbstract` - service info to remove

    - #### unregisterAllServices

          public void unregisterAllServices()

      Unregister all services.
      Specified by:
        `unregisterAllServices` in class `JmDNS`

    - #### registerServiceType

          public boolean registerServiceType(java.lang.String type)

      Register a service type. If this service type was not already known, all service listeners will be notified of the new service type.

      Service types are automatically registered as they are discovered.

      Specified by:
        `registerServiceType` in class `JmDNS`
      Parameters:
        `type` - full qualified service type, such as `_http._tcp.local.`.
      Returns:
        `true` if the type or subtype was added, `false` if the type was already registered.

    - #### addListener

          public void addListener(javax.jmdns.impl.DNSListener listener,
                         DNSQuestion question)

      Add a listener for a question. The listener will receive updates of answers to the question as they arrive, or from the cache if they are already available.
      Parameters:
        `listener` - DSN listener
        `question` - DNS query

    - #### removeListener

          public void removeListener(javax.jmdns.impl.DNSListener listener)

      Remove a listener from all outstanding questions. The listener will no longer receive any updates.
      Parameters:
        `listener` - DSN listener

    - #### renewServiceCollector

          public void renewServiceCollector(DNSRecord record)

      Renew a service when the record become stale. If there is no service collector for the type this method does nothing.
      Parameters:
        `record` - DNS record

    - #### updateRecord

          public void updateRecord(long now,
                          DNSRecord rec,
                          JmDNSImpl.Operation operation)

      Notify all listeners that a record was updated.
      Parameters:
        `now` - update date
        `rec` - DNS record
        `operation` - DNS cache operation

    - #### respondToQuery

          public void respondToQuery(DNSIncoming in)

    - #### addAnswer

          public DNSOutgoing addAnswer(DNSIncoming in,
                              java.net.InetAddress addr,
                              int port,
                              DNSOutgoing out,
                              DNSRecord rec)
                                throws java.io.IOException

      Add an answer to a question. Deal with the case when the outgoing packet overflows
      Parameters:
        `in` -
        `addr` -
        `port` -
        `out` -
        `rec` -
      Returns:
        outgoing answer
      Throws:
        `java.io.IOException`

    - #### send

          public void send(DNSOutgoing out)
                    throws java.io.IOException

      Send an outgoing multicast DNS message.
      Parameters:
        `out` -
      Throws:
        `java.io.IOException`

    - #### purgeTimer

          public void purgeTimer()

      Description copied from interface: `DNSTaskStarter`
      Purge the general task timer
      Specified by:
        `purgeTimer` in interface `DNSTaskStarter`

    - #### purgeStateTimer

          public void purgeStateTimer()

      Description copied from interface: `DNSTaskStarter`
      Purge the state task timer
      Specified by:
        `purgeStateTimer` in interface `DNSTaskStarter`

    - #### cancelTimer

          public void cancelTimer()

      Description copied from interface: `DNSTaskStarter`
      Cancel the generals task timer
      Specified by:
        `cancelTimer` in interface `DNSTaskStarter`

    - #### cancelStateTimer

          public void cancelStateTimer()

      Description copied from interface: `DNSTaskStarter`
      Cancel the state task timer
      Specified by:
        `cancelStateTimer` in interface `DNSTaskStarter`

    - #### startProber

          public void startProber()

      Description copied from interface: `DNSTaskStarter`
      Start a new prober task
      Specified by:
        `startProber` in interface `DNSTaskStarter`

    - #### startAnnouncer

          public void startAnnouncer()

      Description copied from interface: `DNSTaskStarter`
      Start a new announcer task
      Specified by:
        `startAnnouncer` in interface `DNSTaskStarter`

    - #### startRenewer

          public void startRenewer()

      Description copied from interface: `DNSTaskStarter`
      Start a new renewer task
      Specified by:
        `startRenewer` in interface `DNSTaskStarter`

    - #### startCanceler

          public void startCanceler()

      Description copied from interface: `DNSTaskStarter`
      Start a new canceler task
      Specified by:
        `startCanceler` in interface `DNSTaskStarter`

    - #### startReaper

          public void startReaper()

      Description copied from interface: `DNSTaskStarter`
      Start a new reaper task. There is only supposed to be one reaper running at a time.
      Specified by:
        `startReaper` in interface `DNSTaskStarter`

    - #### startServiceInfoResolver

          public void startServiceInfoResolver(ServiceInfoImpl info)

      Description copied from interface: `DNSTaskStarter`
      Start a new service info resolver task
      Specified by:
        `startServiceInfoResolver` in interface `DNSTaskStarter`
      Parameters:
        `info` - service info to resolve

    - #### startTypeResolver

          public void startTypeResolver()

      Description copied from interface: `DNSTaskStarter`
      Start a new service type resolver task
      Specified by:
        `startTypeResolver` in interface `DNSTaskStarter`

    - #### startServiceResolver

          public void startServiceResolver(java.lang.String type)

      Description copied from interface: `DNSTaskStarter`
      Start a new service resolver task
      Specified by:
        `startServiceResolver` in interface `DNSTaskStarter`
      Parameters:
        `type` - service type to resolve

    - #### startResponder

          public void startResponder(DNSIncoming in,
                            int port)

      Description copied from interface: `DNSTaskStarter`
      Start a new responder task
      Specified by:
        `startResponder` in interface `DNSTaskStarter`
      Parameters:
        `in` - incoming message
        `port` - incoming port

    - #### recover

          public void recover()

      Recover jmdns when there is an error.

    - #### cleanCache

          public void cleanCache()

    - #### close

          public void close()

      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`

    - #### printServices

          @Deprecated
          public void printServices()

      Deprecated.
      List Services and serviceTypes. Debugging Only
      Specified by:
        `printServices` in class `JmDNS`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### list

          public ServiceInfo[] list(java.lang.String type)

      Returns a list of service infos of the specified type.
      Specified by:
        `list` in class `JmDNS`
      Parameters:
        `type` - Service type name, such as `_http._tcp.local.`.
      Returns:
        An array of service instance.

    - #### list

          public ServiceInfo[] list(java.lang.String type,
                           long timeout)

      Returns a list of service infos of the specified type.
      Specified by:
        `list` in class `JmDNS`
      Parameters:
        `type` - Service type name, such as `_http._tcp.local.`.
        `timeout` - timeout in milliseconds. Typical timeout should be 6s.
      Returns:
        An array of service instance.

    - #### listBySubtype

          public java.util.Map<java.lang.String,ServiceInfo[]> listBySubtype(java.lang.String type)

      Returns a list of service infos of the specified type sorted by subtype. Any service that do not register a subtype is listed in the empty subtype section.
      Specified by:
        `listBySubtype` in class `JmDNS`
      Parameters:
        `type` - Service type name, such as `_http._tcp.local.`.
      Returns:
        A dictionary of service info by subtypes.

    - #### listBySubtype

          public java.util.Map<java.lang.String,ServiceInfo[]> listBySubtype(java.lang.String type,
                                                                    long timeout)

      Returns a list of service infos of the specified type sorted by subtype. Any service that do not register a subtype is listed in the empty subtype section.
      Specified by:
        `listBySubtype` in class `JmDNS`
      Parameters:
        `type` - Service type name, such as `_http._tcp.local.`.
        `timeout` - timeout in milliseconds. Typical timeout should be 6s.
      Returns:
        A dictionary of service info by subtypes.

    - #### getServices

          public java.util.Map<java.lang.String,ServiceInfo> getServices()

    - #### setLastThrottleIncrement

          public void setLastThrottleIncrement(long lastThrottleIncrement)

    - #### getLastThrottleIncrement

          public long getLastThrottleIncrement()

    - #### setThrottle

          public void setThrottle(int throttle)

    - #### getThrottle

          public int getThrottle()

    - #### getRandom

          public static java.util.Random getRandom()

    - #### ioLock

          public void ioLock()

    - #### ioUnlock

          public void ioUnlock()

    - #### setPlannedAnswer

          public void setPlannedAnswer(DNSIncoming plannedAnswer)

    - #### getPlannedAnswer

          public DNSIncoming getPlannedAnswer()

    - #### getServiceTypes

          public java.util.Map<java.lang.String,JmDNSImpl.ServiceTypeEntry> getServiceTypes()

    - #### getSocket

          public java.net.MulticastSocket getSocket()

    - #### getGroup

          public java.net.InetAddress getGroup()

    - #### getDelegate

          public JmDNS.Delegate getDelegate()

      Description copied from class: `JmDNS`
      Returns the instance delegate
      Specified by:
        `getDelegate` in class `JmDNS`
      Returns:
        instance delegate

    - #### setDelegate

          public JmDNS.Delegate setDelegate(JmDNS.Delegate delegate)

      Description copied from class: `JmDNS`
      Sets the instance delegate
      Specified by:
        `setDelegate` in class `JmDNS`
      Parameters:
        `delegate` - new instance delegate
      Returns:
        previous instance delegate