Class ServerDesc

  • All Implemented Interfaces:
    Serializable

    public final class ServerDesc
    extends Object
    implements Serializable
    Description of an agent server. It is used by Channel and Network objects. Be careful, this structure is initialized in AgentServer, but it can be viewed outside of the agent package, so it's very important to make all modifiers package.
    See Also:
    Serialized Form
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        define serialVersionUID for interoperability
        See Also:
        Constant Field Values
      • sid

        short sid
        Server unique identifier.
      • name

        String name
        Server name.
      • sockAddrs

        private Vector<SocketAddress> sockAddrs
        The IP address of the server. It contains hostname and port (SocketAddress) of remote server. The communication port is set only if the server is directly accessible from this node; in this case it corresponds to the communication port of the server in the adjoining domain. The descriptor of an HA server contains one SocketAddress for each of its constituent.
      • services

        transient ServiceDesc[] services
        Description of services running on this server.
      • gateway

        short gateway
        Server Identifier of a gateway server for this server if it is not in an adjoining domain.
      • domain

        private transient MessageConsumer domain
        Domain description of this server.
      • active

        transient volatile boolean active
        True if there is no waiting messages for this server.
      • last

        transient volatile long last
        Date of the last unsuccessful connection to this server.
      • retry

        transient volatile int retry
        Number of unsuccessful connection to this server. /!\ Be careful, this counter is incremented in a non-atomic way so its value can be lower than reality. However, this counter is only used to handle the delay between 2 connection attempts.
    • Constructor Detail

      • ServerDesc

        public ServerDesc​(short sid,
                          String name,
                          String hostname,
                          int port)
        Constructs a new node for a persistent agent server.
        Parameters:
        sid - the server unique id
        name - the server name
        hostname - the server hostname
        port - the server port
    • Method Detail

      • getServerId

        public short getServerId()
        Gets server id. for this server.
        Returns:
        the server id.
      • getServerName

        public String getServerName()
        Gets server name for this server.
        Returns:
        the server name.
      • getHostname

        public String getHostname()
        Gets hostname for this server.
        Returns:
        the hostname.
      • getPort

        public int getPort()
        Gets port for this server.
        Returns:
        the port.
      • getAddr

        public InetAddress getAddr()
        Returns an IP address for its server.
        Returns:
        an IP address for this server.
      • resetAddr

        public InetAddress resetAddr()
        Resolves an IP address for its server, don't use an eventually caching address.
        Returns:
        an IP address for this server.
      • addSockAddr

        void addSockAddr​(String hostname,
                         int port)
      • updateSockAddr

        public void updateSockAddr​(String hostname,
                                   int port)
      • moveToFirst

        void moveToFirst​(SocketAddress addr)
        In case of an HA server, selects the IP address as this of the master component of the HA configuration.
        Parameters:
        addr - the socket address.
      • getSockAddrs

        Enumeration<SocketAddress> getSockAddrs()
        In case of an HA server, gets the IP address of all the components of the HA configuration.
        Returns:
        the IP address of all the components of the HA configuration.
      • getServices

        public ServiceDesc[] getServices()
        Gets the description of services running on this server.
        Returns:
        the description of services.
      • getGateway

        public short getGateway()
      • setGateway

        public void setGateway​(short id)
      • getDomainName

        public String getDomainName()
      • toString

        public String toString()
        Provides a string image for this object.
        Overrides:
        toString in class Object
        Returns:
        printable image of this object