Class ServerInfo

  • All Implemented Interfaces:
    java.lang.Comparable

    public class ServerInfo
    extends java.lang.Object
    implements java.lang.Comparable
    Provide connection information for the client to the server node in cache.
    • Constructor Summary

      Constructors 
      Constructor Description
      ServerInfo()  
      ServerInfo​(java.lang.String name)
      Initializes a new instance of ServerInfo.
      ServerInfo​(java.lang.String name, int port)
      Initializes a new instance of ServerInfo.
      ServerInfo​(java.net.InetAddress ip)
      Initializes new instance of ServerInfo.
      ServerInfo​(java.net.InetAddress ip, int port)
      Initializes new instance of ServerInfo.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(java.lang.Object obj)
      Compares the ServerInfo on the basis of priority
      boolean equals​(java.lang.Object obj)
      Compares two ServerInfo instances.
      java.net.InetAddress getIP()
      Gets the IPAddress of the server node where cache is running.
      java.lang.String getName()
      Gets the name of the server node where cache is running.
      int getPort()
      Gets the port for client to connect to the server node.
      void setIP​(java.lang.String value)
      Sets the IPAddress of the server node where cache is running.
      void setIP​(java.net.InetAddress value)
      Sets the IPAddress of the server node where cache is running.
      void setName​(java.lang.String value)
      Gets the name of the server node where cache is running.
      void setPort​(int value)
      Sets the port for client to connect to the server node.
      java.lang.String toString()
      Converts the value of this instance to its equivalent string representation.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ServerInfo

        public ServerInfo​(java.lang.String name)
        Initializes a new instance of ServerInfo.
        Parameters:
        name - Specifies name of the server node where cache is running.
      • ServerInfo

        public ServerInfo​(java.lang.String name,
                          int port)
        Initializes a new instance of ServerInfo.
        Parameters:
        name - Specifies name of the server node where cache is running.
        port - Specifies port for client to connect to the server node.
      • ServerInfo

        public ServerInfo​(java.net.InetAddress ip)
        Initializes new instance of ServerInfo.
        Parameters:
        ip - Specifies InetAddress of the server node where cache is running.
      • ServerInfo

        public ServerInfo​(java.net.InetAddress ip,
                          int port)
        Initializes new instance of ServerInfo.
        Parameters:
        ip - Specifies InetAddress of the server node where cache is running.
        port - Specifies port for client to connect to the server node.
      • ServerInfo

        public ServerInfo()
    • Method Detail

      • getPort

        public final int getPort()
        Gets the port for client to connect to the server node.
        Returns:
        The port for client to connect to the server node.
      • setPort

        public final void setPort​(int value)
        Sets the port for client to connect to the server node.
        Parameters:
        value - The port for client to connect to the server node.
      • getName

        public final java.lang.String getName()
        Gets the name of the server node where cache is running.
        Returns:
        The name of the server node where cache is running.
      • setName

        public final void setName​(java.lang.String value)
        Gets the name of the server node where cache is running.
        Parameters:
        value - The name of the server node where cache is running.
      • getIP

        public final java.net.InetAddress getIP()
        Gets the IPAddress of the server node where cache is running.
        Returns:
        The IPAddress of the server node where cache is running.
      • setIP

        public final void setIP​(java.net.InetAddress value)
        Sets the IPAddress of the server node where cache is running.
        Parameters:
        value - The IPAddress of the server node where cache is running.
      • setIP

        public final void setIP​(java.lang.String value)
        Sets the IPAddress of the server node where cache is running.
        Parameters:
        value - The IPAddress of the server node where cache is running in form of a string.
      • equals

        public boolean equals​(java.lang.Object obj)
        Compares two ServerInfo instances.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - The server info object to compare.
        Returns:
        True if specified object is equal to this object otherwise false.
      • toString

        public java.lang.String toString()
        Converts the value of this instance to its equivalent string representation.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string representation of ServerInfo.
      • compareTo

        public final int compareTo​(java.lang.Object obj)
        Compares the ServerInfo on the basis of priority
        Specified by:
        compareTo in interface java.lang.Comparable
        Parameters:
        obj - The server info object to compare.
        Returns:
        0 if equals, -1 if lesser and 1 if greater than the comparing serverInfo