Class EConfigure.RemoteConnection

  • All Implemented Interfaces:
    Comparable<EConfigure.RemoteConnection>
    Enclosing class:
    EConfigure

    public static final class EConfigure.RemoteConnection
    extends EConfigure.AbstractConfig
    implements Comparable<EConfigure.RemoteConnection>
    This immutable class stores the information pertaining to a remote eBus connection. The remote connection JSON properties are:
    Remote Connection JSON Properties
    Property Required? Type Default Description
    name Yes String NA Unique remote connection name. Duplicate names within the connections array are not allowd.
    connectionType No EConfigure.ConnectionType EConfigure.ConnectionType.TCP Protocol used to establish connection to remote eBus peer. EConfigure.ConnectionType.SECURE_TCP and EConfigure.ConnectionType.SECURE_UDP are not allowed when defined in a configuration file since this requires placing sensitive information in the clear in this file.
    host Yes String NA eBus peer host specified either as a name or in dotted notation.
    port Yes int NA eBus peer port. Must be an integer value > zero and < 65,536.
    bindHost No String Wildcard address Bind connection local host to this value. If set to null then local address is bound to the wildcard address.
    bindPort No int ENetConfigure.ANY_PORT Bind connection local port to this value. If set to ENetConfigure.ANY_PORT then local port is bound to any available ephemeral port.
    inputBufferSize No int ENetConfigure.DEFAULT_BUFFER_SIZE Connection input buffer size. Limits number of bytes received at one time.
    outputBufferSize No int ENetConfigure.DEFAULT_BUFFER_SIZE Connection output buffer size. Limits number of bytes transmitted at one time.
    byteOrder No ByteOrder EConfigure.DEFAULT_BYTE_ORDER eBus messages are encode/decoded in this byte order.
    messageQueueSize No int EConfigure.DEFAULT_QUEUE_SIZE Outbound message queue size. A zero queue size means the queue size is unlimited. Used only for TCP connection types.
    selector No String Default eBus selector. Remote connection channel is monitored by this eBus selector thread.
    reconnect No boolean false If true, then reconnects after unexpected connection loss. Used only for TCP connection types.
    reconnectTime Yes if reconnect is true int followed by time unit. Example: 15 seconds Zero Wait this time limit after disconnecting and each reconnect attempt.
    heartbeatDelay No int followed by time unit. Example: 30 seconds EConfigure.DEFAULT_HEARTBEAT_DELAY Wait this delay after latest inbound message before sending heartbeat message. If zero then heartbeating is turned off.
    heartbeatReplyDelay No int followed by time unit. Example: 500 milliseconds EConfigure.DEFAULT_HEARTBEAT_REPLY_DELAY Wait this time limit for a reply to a heartbeat message. A zero setting means wait indefinitely. If heartbeatDelay is zero, then this value is ignored.
    canPause No boolean false If true, then this connection may be paused according to EConfigure.PauseConfig settings.

    Example remote connection configuration.

    name : conn1
    host : "127.0.0.1"
    port : 12346
    bindPort : 54321
    byteOrder : BIG_ENDIAN
    selector : selector1
    inputBufferSize : 8192
    outputBufferSize : 65536
    messageQueueSize : 100
    reconnect : true
    reconnectTime : 500ms
    canPause : false
    See Also:
    EConfigure.Service, EConfigure.PauseConfig
    • Method Detail

      • compareTo

        public int compareTo​(EConfigure.RemoteConnection conn)
        Compares this remote connection configuration with conn.
        Specified by:
        compareTo in interface Comparable<EConfigure.RemoteConnection>
        Parameters:
        conn - compare with this object.
        Returns:
        < zero if this instance is less than conn; zero if this instance is equal to conn; > zero if this is greater than conn.
      • equals

        public boolean equals​(Object o)
        Returns true if o is a non-null RemoteConnection instance with the same name; false otherwise.
        Overrides:
        equals in class Object
        Parameters:
        o - Test equality with this object.
        Returns:
        true if o is a non-null RemoteConnection instance with the same address and connection type; false otherwise.
      • hashCode

        public int hashCode()
        Returns the remote connection address hash code.
        Overrides:
        hashCode in class Object
        Returns:
        the remote connection address hash code.
      • toString

        public String toString()
        Returns a text representation for this remote connection.
        Overrides:
        toString in class Object
        Returns:
        a text representation for this remote connection.
      • address

        public InetSocketAddress address()
        Returns the remote eBus socket address.
        Returns:
        the remote eBus socket address.
      • bindAddress

        public InetSocketAddress bindAddress()
        Returns the connection bind host and port to which local address is bound.
        Returns:
        the connection bind address.
      • selector

        public String selector()
        Returns the selector information to which this connection is registered.
        Returns:
        selector information.
      • reconnectFlag

        public boolean reconnectFlag()
        Returns true if connection is to be re-established when lost.
        Returns:
        true if connection is to be re-established when lost.
      • reconnectTime

        public Duration reconnectTime()
        Returns the reconnect delay.
        Returns:
        the reconnect delay.