Class ServerInfo

  • All Implemented Interfaces:
    java.lang.Comparable

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

      Constructors 
      Constructor Description
      ServerInfo()
      Initializes new instance of 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.lang.String name, int port, boolean isloadbalancer)
      It is used in the case of load balancer where the underlying machines are behind a load balancer.
      ServerInfo​(java.net.InetAddress ip)
      Initializes new instance of ServerInfo.
      ServerInfo​(java.net.InetAddress ip, int port)
      Initializes new instance of ServerInfo.
      ServerInfo​(java.net.InetAddress ip, int port, boolean isloadbalancer)
      Used For the case of load balancer.
    • 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 IP Address of the server node where cache is running.
      boolean getIsLoadBalancer()
      Gets the value that indicates if the machine is a load balancer
      java.lang.String getName()  
      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 IP Address of the server node where cache is running.
      void setIsLoadBalancer​(boolean value)
      Sets the value that indicates if the machine is a load balancer
      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

        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.lang.String name,
                          int port,
                          boolean isloadbalancer)
        It is used in the case of load balancer where the underlying machines are behind a load balancer. The isLoadBalancer flag passed in the constructor signifies whether the server being added is the load balancer or the underlying machine.
        Parameters:
        name - Specifies name of the server node where cache is running.
        port - Specifies port for client to connect to the server node.
        isloadbalancer - Specifies whether the server is a load balancer
      • 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​(java.net.InetAddress ip,
                          int port,
                          boolean isloadbalancer)
        Used For the case of load balancer. When the underlying machines are behind a load balancer The isLoadBalancer flag signifies whether the server being added is the load balancer or if it's the underlying machine
        Parameters:
        ip - Specifies InetAddress of the server node where cache is running.
        port - Specifies port for client to connect to the server node.
        isloadbalancer - Specifies whether the server is a load balancer
      • ServerInfo

        public ServerInfo()
        Initializes new instance of 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.
      • setIsLoadBalancer

        public void setIsLoadBalancer​(boolean value)
        Sets the value that indicates if the machine is a load balancer
        Parameters:
        value - True if the machine is a load balancer
      • getIsLoadBalancer

        public boolean getIsLoadBalancer()
        Gets the value that indicates if the machine is a load balancer
        Returns:
        True if the machine is a load balancer
      • getName

        public final java.lang.String getName()
      • 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 IP Address of the server node where cache is running.
        Returns:
        The IP Address of the server node where cache is running.
      • setIP

        public final void setIP​(java.net.InetAddress value)
        Sets the IP Address of the server node where cache is running.
        Parameters:
        value - The IP Address 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.