Interface DNSStatefulObject

All Known Implementing Classes:
DNSStatefulObject.DefaultImplementation, HostInfo, HostInfo.HostInfoState, JmDNSImpl, ServiceInfoImpl, ServiceInfoImpl.ServiceInfoState

public interface DNSStatefulObject
Sets of methods to manage the state machine.
Implementation note: This interface is accessed from multiple threads. The implementation must be thread safe.
  • Method Details

    • getDns

      JmDNSImpl getDns()
      Returns the DNS associated with this object.
      Returns:
      DNS resolver
    • associateWithTask

      void associateWithTask(DNSTask task, DNSState state)
      Sets the task associated with this Object.
      Parameters:
      task - associated task
      state - state of the task
    • removeAssociationWithTask

      void removeAssociationWithTask(DNSTask task)
      Remove the association of the task with this Object.
      Parameters:
      task - associated task
    • isAssociatedWithTask

      boolean isAssociatedWithTask(DNSTask task, DNSState state)
      Checks if this object is associated with the task and in the same state.
      Parameters:
      task - associated task
      state - state of the task
      Returns:
      true is the task is associated with this object, false otherwise.
    • advanceState

      boolean advanceState(DNSTask task)
      Sets the state and notifies all objects that wait on the ServiceInfo.
      Parameters:
      task - associated task
      Returns:
      true if the state was changed by this thread, false otherwise.
      See Also:
    • revertState

      boolean revertState()
      Sets the state and notifies all objects that wait on the ServiceInfo.
      Returns:
      true if the state was changed by this thread, false otherwise.
      See Also:
    • cancelState

      boolean cancelState()
      Sets the state and notifies all objects that wait on the ServiceInfo.
      Returns:
      true if the state was changed by this thread, false otherwise.
    • closeState

      boolean closeState()
      Sets the state and notifies all objects that wait on the ServiceInfo.
      Returns:
      true if the state was changed by this thread, false otherwise.
    • recoverState

      boolean recoverState()
      Sets the state and notifies all objects that wait on the ServiceInfo.
      Returns:
      true if the state was changed by this thread, false otherwise.
    • isProbing

      boolean isProbing()
      Returns true, if this is a probing state.
      Returns:
      true if probing state, false otherwise
    • isAnnouncing

      boolean isAnnouncing()
      Returns true, if this is an announcing state.
      Returns:
      true if announcing state, false otherwise
    • isAnnounced

      boolean isAnnounced()
      Returns true, if this is an announced state.
      Returns:
      true if announced state, false otherwise
    • isCanceling

      boolean isCanceling()
      Returns true, if this is a canceling state.
      Returns:
      true if canceling state, false otherwise
    • isCanceled

      boolean isCanceled()
      Returns true, if this is a canceled state.
      Returns:
      true if canceled state, false otherwise
    • isClosing

      boolean isClosing()
      Returns true, if this is a closing state.
      Returns:
      true if closing state, false otherwise
    • isClosed

      boolean isClosed()
      Returns true, if this is a closed state.
      Returns:
      true if closed state, false otherwise
    • waitForAnnounced

      boolean waitForAnnounced(long timeout)
      Waits for the object to be announced.
      Parameters:
      timeout - the maximum time to wait in milliseconds.
      Returns:
      true if the object is announced, false otherwise
    • waitForCanceled

      boolean waitForCanceled(long timeout)
      Waits for the object to be canceled.
      Parameters:
      timeout - the maximum time to wait in milliseconds.
      Returns:
      true if the object is canceled, false otherwise