Class SlaveAddress


  • public class SlaveAddress
    extends java.lang.Object
    Encapsulates the host name and the port number of the slave machine.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEFAULT_PORT_NO
      Used as the default port number if the port number is not mentioned.
      private java.net.InetAddress hostAddress
      Contains the IP Address of the slave to replicate to.
      private int portNumber
      Contains the port number at which the slave is listening for connections from the master.
    • Constructor Summary

      Constructors 
      Constructor Description
      SlaveAddress​(java.lang.String hostName, int portNumber)
      Constructor initializes the host name and the port number with valid values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.net.InetAddress getHostAddress()
      Used to get the IP Address corresponding to the host name of the slave.
      int getPortNumber()
      Used to get the port number of the slave.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • hostAddress

        private final java.net.InetAddress hostAddress
        Contains the IP Address of the slave to replicate to.
      • portNumber

        private final int portNumber
        Contains the port number at which the slave is listening for connections from the master.
      • DEFAULT_PORT_NO

        public static final int DEFAULT_PORT_NO
        Used as the default port number if the port number is not mentioned. Port number 4851 is registered for Derby Replication at IANA (See: http://www.iana.org/assignments/port-numbers)
        See Also:
        Constant Field Values
    • Constructor Detail

      • SlaveAddress

        public SlaveAddress​(java.lang.String hostName,
                            int portNumber)
                     throws java.net.UnknownHostException
        Constructor initializes the host name and the port number with valid values. If a valid host name or port number is not provided then these are initialized to default values.
        Parameters:
        hostName - a String that contains the host name of the slave.
        portNumber - an int that contains the port number of the slave.
        Throws:
        java.net.UnknownHostException - If an exception occurs while trying to resolve the host name.
    • Method Detail

      • getHostAddress

        public java.net.InetAddress getHostAddress()
        Used to get the IP Address corresponding to the host name of the slave.
        Returns:
        an IP Address corresponding to the slave host name.
      • getPortNumber

        public int getPortNumber()
        Used to get the port number of the slave.
        Returns:
        an int representing the value of the port number of the slave.