Class EConfigure.AbstractBuilder<T extends EConfigure.AbstractBuilder>

    • Field Detail

      • mName

        protected String mName
        Unique service or connection name.
      • mOutputBufferSize

        protected int mOutputBufferSize
        Maximum output buffer size. May be override by SSLSession.getPacketBufferSize() when using a secure TCP connection.
      • mByteOrder

        protected ByteOrder mByteOrder
        Code and decode messages in this byte order.
      • mMsgQueueSize

        protected int mMsgQueueSize
        Maximum eBus message outbound queue size for remote connections. When the queue outbound message count exceeds this size, the remote connection is automatically closed and the outbound messages discarded.
      • mHbDelay

        protected Duration mHbDelay
        Send a heartbeat message after this many milliseconds of inbound message inactivity.
      • mHbReplyDelay

        protected Duration mHbReplyDelay
        The number of milliseconds the far-end has to respond to a heartbeat. If the response is not received after this many milliseconds, the remote connection is automatically closed.
      • mSSLContext

        protected SSLContext mSSLContext
        The SSL/TLS context used for a secure TCP connection.
      • mCanPause

        protected boolean mCanPause
        Set to true if remote connections may be paused.
      • mLoaderFlag

        protected boolean mLoaderFlag
        Set to true if this builder is used when loading a configuration. This flag is used to detect when a secure TCP session is defined in a configuration as opposed to built by an application. If so, then the session definition is not required to define the SSL context.
      • mRetransmitDelay

        protected Duration mRetransmitDelay
        Re-transmit application message over reliable UDP after waiting this long for an application message receipt.

        This configuration only applies to a reliable UDP connection.

      • mRetransmitLimit

        protected int mRetransmitLimit
        Re-transmit application message at most this many times before declaring reliable UDP connection lost. Does not apply to initial transmit.

        This configuration only applies to a reliable UDP connection.

    • Constructor Detail

      • AbstractBuilder

        protected AbstractBuilder()
        Creates a new abstract configuration builder.
    • Method Detail

      • name

        public final T name​(String name)
        Sets the service/connection name.
        Parameters:
        name - service/connection name.
        Returns:
        this service/connection builder.
        Throws:
        com.typesafe.config.ConfigException - if name is null or empty.
      • connectionType

        public final T connectionType​(EConfigure.ConnectionType connType)
        Sets the underlying channel type.
        Parameters:
        connType - channel type.
        Returns:
        this service/connection builder.
        Throws:
        com.typesafe.config.ConfigException - if connType is null.
      • inputBufferSize

        public final T inputBufferSize​(int size)
        Sets the input buffer size for the connection. If size is zero, then the default input buffer size is used.
        Parameters:
        size - connection input buffer size.
        Returns:
        this service/connection builder.
        Throws:
        com.typesafe.config.ConfigException - if size < zero.
      • outputBufferSize

        public final T outputBufferSize​(int size)
        Sets the output buffer size for the connection. If size is zero, then the default output buffer size is used.
        Parameters:
        size - connection output buffer size.
        Returns:
        this service/connection builder.
        Throws:
        com.typesafe.config.ConfigException - if size < zero.
      • byteOrder

        public final T byteOrder​(ByteOrder byteOrder)
        Sets the byte order used by the connection.
        Parameters:
        byteOrder - connection serialize and de-serialize messages using this byte order.
        Returns:
        this service/connection builder.
        Throws:
        com.typesafe.config.ConfigException - if byteOrder is nuill.
      • messageQueueSize

        public final T messageQueueSize​(int size)
        Sets the maximum queue size for the connection. When the message queue size reaches this maximum, the connection is automatically closed. If zero, then the default maximum queue size is used.
        Parameters:
        size - message queue maximum size.
        Returns:
        this service/connection builder.
        Throws:
        com.typesafe.config.ConfigException - if size < zero.
      • heartbeatDelay

        public final T heartbeatDelay​(Duration delay)
        Sets the heartbeat delay used for the connection. If no message is received after delay milliseconds, then a heartbeat is sent. If delay is zero, then heartbeating is turned off.
        Parameters:
        delay - millisecond heartbeat rate.
        Returns:
        this service/connection builder.
        Throws:
        com.typesafe.config.ConfigException - if delay < zero.
      • heartbeatReplyDelay

        public final T heartbeatReplyDelay​(Duration delay)
        Sets the heartbeat reply delay used for the connection. The remote eBus application has this many milliseconds to reply to a heartbeat. If no reply is received after delay milliseconds, the connection is closed. This value is ignored if the heartbeat delay is zero.
        Parameters:
        delay - millisecond heartbeat reply delay.
        Returns:
        this service/connection builder.
        Throws:
        com.typesafe.config.ConfigException - if delay is null or < zero.
      • sslContext

        public final T sslContext​(SSLContext context)
        Sets the SSL/TLS context used by a secure location. This should be called only if the connection type is set to EConfigure.ConnectionType.SECURE_TCP.
        Parameters:
        context - secure TCP context.
        Returns:
        this server/connection builder.
        Throws:
        com.typesafe.config.ConfigException - if context is null.
      • canPause

        public final T canPause​(boolean flag)
        Sets a flag specifying whether accepted connections may be paused (true) or not.
        Parameters:
        flag - pause-able connection flag.
        Returns:
        this connection builder.
      • pauseConfig

        public final T pauseConfig​(EConfigure.PauseConfig pc)
        Sets the pause configuration for the connection.

        canPause(boolean) must be set to true before setting the pause configuration.

        Parameters:
        pc - pause configuration
        Returns:
        this server/connection builder.
        Throws:
        com.typesafe.config.ConfigException - if canPause(boolean) returns false (meaning the connection cannot be pause) or if pc is null.
      • retransmitDelay

        public final T retransmitDelay​(Duration delay)
        Sets reliable UDP application message re-transmit delay.
        Parameters:
        delay - application message re-transmit delay.
        Returns:
        this server/connection builder.
        Throws:
        com.typesafe.config.ConfigException - if delay is either null or a negative value.
      • retransmitLimit

        public final T retransmitLimit​(int limit)
        Sets reliable UDP application message re-transmit limit. This limit does not include the initial message transmit.
        Parameters:
        limit - maximum number of times an application message may be sent before declaring a reliable UDP connection lost.
        Returns:
        this server/connection builder.
        Throws:
        com.typesafe.config.ConfigException - if limit is ≤ zero.
      • configuration

        protected T configuration​(EConfigure.AbstractConfig config)
        Copies the values found in config to this configuration. This method is used to modify an existing immutable configuration.
        Parameters:
        config - copy this configuration's values.
        Returns:
        this server/connection builder.
      • loaderFlag

        protected final T loaderFlag​(boolean flag)
        Sets the loader flag to the given value.
        Parameters:
        flag - loader flag value.
        Returns:
        this server/connection builder.
      • validate

        protected Validator validate​(Validator problems)
        Validates builder arguments are correctly set, listing validation errors in problems list. This validation is "fail slow" meaning that a single validation call will determine all configuration errors.
        Parameters:
        problems - record configuration problems in this list.
        Returns:
        problems so validate calls may be chained together.