Class EConfigure.Service

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

    public static final class EConfigure.Service
    extends EConfigure.AbstractConfig
    implements Comparable<EConfigure.Service>
    This immutable class stores the configuration for an eBus service. The service properties are:
    Service JSON Properties
    Property Required? Type Default Description
    name Yes String NA Unique service name. Duplicate names with the services array are not allowed.
    connectionType No EConfigure.ConnectionType EConfigure.ConnectionType.TCP Server and accepted connection type. 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.
    port Yes int > zero and < 65,536 NA Server socket port.
    addressFilter No AddressFilter null Optional address filter used to decide if a remote eBus is allowed to connect to this eBus service.
    inputBufferSize No int ENetConfigure.DEFAULT_BUFFER_SIZE Accepted socket input buffer size. Limits number of bytes received at one time.
    outputBufferSize No int ENetConfigure.DEFAULT_BUFFER_SIZE Accepted socket output buffer size. Limits number of bytes transmitted at one time.
    byteOrder No ByteOrder EConfigure.DEFAULT_BYTE_ORDER Accepted socket encodes/decodes eBus messages using this byte ordering.
    messageQueueSize No int EConfigure.DEFAULT_QUEUE_SIZE Accepted socket outbound message queue size. A zero queue size means the queue size is unlimited. Used only for TCP connection types.
    serviceSelector No String Default eBus selector thread Service socket is monitored by this selector thread.
    connectionSelector No String Default eBus selector thread Accepted sockets are monitored by this selector thread.
    heartbeatDelay No int followed by time unit. Example: 30 seconds Zero (no heartbeating} Accepted socket heartbeat rate. A zero heartbeat rate means accepted sockets do not send heartbeat messages to peer.
    heartbeatReplyDelay No int followed by time unit. Example: 500 milliseconds. Zero (wait indefinitely for reply) Accepted sockets wait this long for reply to heartbeat message. A zero heartbeat reply delay means wait indefinitely. This setting is ignored in heartbeat rate is zero.
    canPause No boolean false If true accepted sockets support pause requests from peer according to EConfigure.PauseConfig settings.

    Example service configuration.

    name : service1
    port : 12345
    addressFilter : [
        "127.0.0.1",
        "127.0.0.1:54321"
    ]
    serviceSelector : selector1
    connectionSelector : selector1
    byteOrder : LITTLE_ENDIAN
    inputBufferSize : 8192
    outputBufferSize : 65536
    messageQueueSize : 100
    canPause : false
    See Also:
    EConfigure.RemoteConnection, EConfigure.PauseConfig
    • Method Detail

      • compareTo

        public int compareTo​(EConfigure.Service service)
        Compares this service configuration with service based on the service ports.
        Specified by:
        compareTo in interface Comparable<EConfigure.Service>
        Parameters:
        service - compare this service instance.
        Returns:
        an integer value.
      • equals

        public boolean equals​(Object o)
        Returns true if o is a Service instance with the same port and false otherwise.
        Overrides:
        equals in class Object
        Parameters:
        o - Test if this object is equal.
        Returns:
        true if o is a Service instance with the same port and false otherwise.
      • hashCode

        public int hashCode()
        Returns the service port.
        Overrides:
        hashCode in class Object
        Returns:
        the service port.
      • toString

        public String toString()
        Returns a text representation of this eBus service.
        Overrides:
        toString in class Object
        Returns:
        a text representation of this eBus service.
      • port

        public int port()
        Returns the service port.
        Returns:
        the service port.
      • addressFilter

        public AddressFilter addressFilter()
        Returns the address filter. May return nul.
        Returns:
        the address filter.
      • serviceSelector

        public String serviceSelector()
        Returns the selector information to which the service socket channel is registered.
        Returns:
        service socket channel selector.
      • connectionSelector

        public String connectionSelector()
        Returns the selector information to which accepted connections are registered.
        Returns:
        accepted connection selector information.