Class InstanceSpec


  • public class InstanceSpec
    extends Object
    Abstracts one of the servers in the ensemble
    • Constructor Detail

      • InstanceSpec

        public InstanceSpec​(File dataDirectory,
                            int port,
                            int electionPort,
                            int quorumPort,
                            boolean deleteDataDirectoryOnClose,
                            int serverId)
        Parameters:
        dataDirectory - where to store data/logs/etc.
        port - the port to listen on - each server in the ensemble must use a unique port
        electionPort - the electionPort to listen on - each server in the ensemble must use a unique electionPort
        quorumPort - the quorumPort to listen on - each server in the ensemble must use a unique quorumPort
        deleteDataDirectoryOnClose - if true, the data directory will be deleted when TestingCluster.close() is called
        serverId - the server ID for the instance
      • InstanceSpec

        public InstanceSpec​(File dataDirectory,
                            int port,
                            int electionPort,
                            int quorumPort,
                            boolean deleteDataDirectoryOnClose,
                            int serverId,
                            int tickTime,
                            int maxClientCnxns)
        Parameters:
        dataDirectory - where to store data/logs/etc.
        port - the port to listen on - each server in the ensemble must use a unique port
        electionPort - the electionPort to listen on - each server in the ensemble must use a unique electionPort
        quorumPort - the quorumPort to listen on - each server in the ensemble must use a unique quorumPort
        deleteDataDirectoryOnClose - if true, the data directory will be deleted when TestingCluster.close() is called
        serverId - the server ID for the instance
        tickTime - tickTime. Set -1 to used fault server configuration
        maxClientCnxns - max number of client connections from the same IP. Set -1 to use default server configuration
      • InstanceSpec

        public InstanceSpec​(File dataDirectory,
                            int port,
                            int electionPort,
                            int quorumPort,
                            boolean deleteDataDirectoryOnClose,
                            int serverId,
                            int tickTime,
                            int maxClientCnxns,
                            Map<String,​Object> customProperties)
        Parameters:
        dataDirectory - where to store data/logs/etc.
        port - the port to listen on - each server in the ensemble must use a unique port
        electionPort - the electionPort to listen on - each server in the ensemble must use a unique electionPort
        quorumPort - the quorumPort to listen on - each server in the ensemble must use a unique quorumPort
        deleteDataDirectoryOnClose - if true, the data directory will be deleted when TestingCluster.close() is called
        serverId - the server ID for the instance
        tickTime - tickTime. Set -1 to used fault server configuration
        maxClientCnxns - max number of client connections from the same IP. Set -1 to use default server configuration
        customProperties - other properties to be passed to the server
      • InstanceSpec

        public InstanceSpec​(File dataDirectory,
                            int port,
                            int electionPort,
                            int quorumPort,
                            boolean deleteDataDirectoryOnClose,
                            int serverId,
                            int tickTime,
                            int maxClientCnxns,
                            Map<String,​Object> customProperties,
                            String hostname)
        Parameters:
        dataDirectory - where to store data/logs/etc.
        port - the port to listen on - each server in the ensemble must use a unique port
        electionPort - the electionPort to listen on - each server in the ensemble must use a unique electionPort
        quorumPort - the quorumPort to listen on - each server in the ensemble must use a unique quorumPort
        deleteDataDirectoryOnClose - if true, the data directory will be deleted when TestingCluster.close() is called
        serverId - the server ID for the instance
        tickTime - tickTime. Set -1 to used fault server configuration
        maxClientCnxns - max number of client connections from the same IP. Set -1 to use default server configuration
        customProperties - other properties to be passed to the server
        hostname - Hostname or IP if the cluster is intending to be bounded into external interfaces
    • Method Detail

      • reset

        public static void reset()
      • newInstanceSpec

        public static InstanceSpec newInstanceSpec()
      • getRandomPort

        public static int getRandomPort()
      • getServerId

        public int getServerId()
      • getDataDirectory

        public File getDataDirectory()
      • getPort

        public int getPort()
      • getElectionPort

        public int getElectionPort()
      • getQuorumPort

        public int getQuorumPort()
      • getConnectString

        public String getConnectString()
      • getTickTime

        public int getTickTime()
      • getMaxClientCnxns

        public int getMaxClientCnxns()
      • deleteDataDirectoryOnClose

        public boolean deleteDataDirectoryOnClose()
      • getHostname

        public String getHostname()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object