Interface SocketAddressProvider

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void accept()
      This method should be called by the client immediately after it determines that it can successfully use an address returned by the getNextAddress() method.
      boolean equals​(Object o)
      SocketAddressProvider instances are considered equivalent iff they consistently produce the same resulting set of addresses.
      SocketAddress getNextAddress()
      Obtain a next available address to use.
      int hashCode()
      Return the hash code for this SocketAddressProvider.
      void reject​(Throwable eCause)
      This method should be called by the client immediately after it determines that an attempt to use an address returned by the getNextAddress() method has failed.
    • Method Detail

      • getNextAddress

        SocketAddress getNextAddress()
        Obtain a next available address to use. If the caller can successfully use the returned address (e.g. a connection was established), it should call the SocketAddressProvider's accept() method.
        Returns:
        the next available address or null if the list of available addresses was exhausted
      • accept

        void accept()
        This method should be called by the client immediately after it determines that it can successfully use an address returned by the getNextAddress() method.
      • reject

        void reject​(Throwable eCause)
        This method should be called by the client immediately after it determines that an attempt to use an address returned by the getNextAddress() method has failed.
        Parameters:
        eCause - (optional) an exception that carries the reason why the the caller rejected the previously returned address
      • equals

        boolean equals​(Object o)
        SocketAddressProvider instances are considered equivalent iff they consistently produce the same resulting set of addresses.

        Note: the general contract of hashCode and equals() should be preserved; AddressProviders that are "equal" should produce the same hashCode.

        Overrides:
        equals in class Object
        Parameters:
        o - the Object to compare this SocketAddressProvider to for equality
        Returns:
        true iff this SocketAddressProvider is equal to the specified object
      • hashCode

        int hashCode()
        Return the hash code for this SocketAddressProvider.
        Overrides:
        hashCode in class Object
        Returns:
        the hash code for this SocketAddressProvider