Package com.alachisoft.ncache.client
Class ServerInfo
- java.lang.Object
-
- com.alachisoft.ncache.client.ServerInfo
-
- All Implemented Interfaces:
java.lang.Comparable
public class ServerInfo extends java.lang.Object implements java.lang.ComparableProvides 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 intcompareTo(java.lang.Object obj)Compares the ServerInfo on the basis of priority.booleanequals(java.lang.Object obj)Compares two ServerInfo instances.java.net.InetAddressgetIP()Gets the IP Address of the server node where cache is running.booleangetIsLoadBalancer()Gets the value that indicates if the machine is a load balancerjava.lang.StringgetName()intgetPort()Gets the port for client to connect to the server node.voidsetIP(java.lang.String value)Sets the IPAddress of the server node where cache is running.voidsetIP(java.net.InetAddress value)Sets the IP Address of the server node where cache is running.voidsetIsLoadBalancer(boolean value)Sets the value that indicates if the machine is a load balancervoidsetName(java.lang.String value)Gets the name of the server node where cache is running.voidsetPort(int value)Sets the port for client to connect to the server node.java.lang.StringtoString()Converts the value of this instance to its equivalent string representation.
-
-
-
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- SpecifiesInetAddressof the server node where cache is running.
-
ServerInfo
public ServerInfo(java.net.InetAddress ip, int port)Initializes new instance of ServerInfo.- Parameters:
ip- SpecifiesInetAddressof 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- SpecifiesInetAddressof 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:
equalsin classjava.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:
toStringin classjava.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:
compareToin interfacejava.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.
-
-