Class ReceivingServiceConfigBuilder<R extends BaseConnectionBuilder<?,​?>>

  • Type Parameters:
    R - BaseConnectionBuilder type

    public final class ReceivingServiceConfigBuilder<R extends BaseConnectionBuilder<?,​?>>
    extends java.lang.Object
    Configuration builder to configure ReceivingService. Only intended to be used in combination with BaseConnectionBuilder
    Since:
    4.2.0 - 2022-07-14
    • Constructor Detail

      • ReceivingServiceConfigBuilder

        public ReceivingServiceConfigBuilder​(java.util.function.Supplier<R> _bldr)
    • Method Detail

      • withSignalThreadCount

        public ReceivingServiceConfigBuilder<R> withSignalThreadCount​(int _threads)
        Set the size of the thread-pool used to handle signals from the bus. Caution: Using thread-pool size > 1 may cause signals to be handled out-of-order

        Default: 1

        Parameters:
        _threads - int >= 1
        Returns:
        this
      • withErrorHandlerThreadCount

        public ReceivingServiceConfigBuilder<R> withErrorHandlerThreadCount​(int _threads)
        Set the size of the thread-pool used to handle error messages received on the bus.

        Default: 1

        Parameters:
        _threads - int >= 1
        Returns:
        this
      • withMethodCallThreadCount

        public ReceivingServiceConfigBuilder<R> withMethodCallThreadCount​(int _threads)
        Set the size of the thread-pool used to handle methods calls previously sent to the bus. The thread pool size has to be > 1 to handle recursive calls.

        Default: 4

        Parameters:
        _threads - int >= 1
        Returns:
        this
      • withMethodReturnThreadCount

        public ReceivingServiceConfigBuilder<R> withMethodReturnThreadCount​(int _threads)
        Set the size of the thread-pool used to handle method return values received on the bus.

        Default: 1

        Parameters:
        _threads - int >= 1
        Returns:
        this
      • withSignalThreadPriority

        public ReceivingServiceConfigBuilder<R> withSignalThreadPriority​(int _priority)
        Sets the thread priority of the created signal thread(s).

        Default: Thread.NORM_PRIORITY (5);

        Parameters:
        _priority - int >=1 and <= 10
        Returns:
        this
        Throws:
        java.lang.IllegalArgumentException - when value is out ouf range (value < 1 && > 10)
      • withErrorThreadPriority

        public ReceivingServiceConfigBuilder<R> withErrorThreadPriority​(int _priority)
        Sets the thread priority of the created signal thread(s).

        Default: Thread.NORM_PRIORITY (5);

        Parameters:
        _priority - int >=1 and <= 10
        Returns:
        this
        Throws:
        java.lang.IllegalArgumentException - when value is out ouf range (value < 1 && > 10)
      • withMethedCallThreadPriority

        public ReceivingServiceConfigBuilder<R> withMethedCallThreadPriority​(int _priority)
        Sets the thread priority of the created signal thread(s).

        Default: Thread.NORM_PRIORITY (5);

        Parameters:
        _priority - int >=1 and <= 10
        Returns:
        this
        Throws:
        java.lang.IllegalArgumentException - when value is out ouf range (value < 1 && > 10)
      • withMethodReturnThreadPriority

        public ReceivingServiceConfigBuilder<R> withMethodReturnThreadPriority​(int _priority)
        Sets the thread priority of the created signal thread(s).

        Default: Thread.NORM_PRIORITY (5);

        Parameters:
        _priority - int >=1 and <= 10
        Returns:
        this
        Throws:
        java.lang.IllegalArgumentException - when value is out ouf range (value < 1 && > 10)
      • withRetryHandler

        public ReceivingServiceConfigBuilder<R> withRetryHandler​(ReceivingService.IThreadPoolRetryHandler _handler)
        Sets the retry handler which should be called when executing a runnable in ReceivingService thread pools fail.

        Defaults to an implementation retrying executing the runnable up to ten times. If null is given, retrying will be disabled (but error will be logged).

        Parameters:
        _handler - handler to use
        Returns:
        this
      • connectionConfig

        public R connectionConfig()
        Returns the used ConnectionBuilder for the connection for further configuration.
        Returns:
        connection builder