Class EConfigure.DispatcherBuilder

    • Method Detail

      • configuration

        public EConfigure.DispatcherBuilder configuration​(EConfigure.Dispatcher config)
        Copies in the settings from config to this builder. This method is provided for making changes to an existing configuration since EConfigure.Dispatcher is immutable.

        if config is null, then nothing is done and the builder remains unchanged.

        Parameters:
        config - copy settings from this configuration.
        Returns:
        this dispatcher builder.
      • name

        public EConfigure.DispatcherBuilder name​(String name)
        Sets the dispatcher name.
        Parameters:
        name - dispatcher name.
        Returns:
        this dispatcher builder.
        Throws:
        com.typesafe.config.ConfigException - if name is null or empty.
      • dispatcherType

        public EConfigure.DispatcherBuilder dispatcherType​(EConfigure.DispatcherType type)
        Sets the dispatcher type.
        Parameters:
        type - dispatcher type.
        Returns:
        this dispatcher builder.
        Throws:
        com.typesafe.config.ConfigException - if type is null or an unknown dispatcher type.
      • parkTime

        public EConfigure.DispatcherBuilder parkTime​(Duration time)
        Sets the ThreadType.SPINPARK park time limit. This setting is ignored for any other run queue thread type.
        Parameters:
        time - park time limit.
        Returns:
        this dispatcher builder.
        Throws:
        com.typesafe.config.ConfigException - if time is null or < zero.
      • quantum

        public EConfigure.DispatcherBuilder quantum​(Duration quantum)
        Sets the run quantum assigned to each eBus client.
        Parameters:
        quantum - run quantum.
        Returns:
        this dispatcher builder.
        Throws:
        com.typesafe.config.ConfigException - if quantum is null or < zero.
      • isDefault

        public EConfigure.DispatcherBuilder isDefault​(boolean flag)
        If flag is true, then marks the dispatcher as the default dispatcher.
        Parameters:
        flag - true marks the dispatcher as the default.
        Returns:
        this dispatcher builder.
      • classes

        public EConfigure.DispatcherBuilder classes​(Class<?>[] classes)
        Lists the classes assigned to the dispatcher. If the default dispatcher, this list is ignored and classes may be null or empty. If the dispatcher is not default, then classes must be defined as a non-null, non-empty array.

        This parameter is checked when the dispatcher is built since the validation depends on whether the dispatcher is default or not.

        Parameters:
        classes - eBus client classes assigned to the Dispatcher.
        Returns:
        this dispatcher builder.
      • threadAffinity

        public EConfigure.DispatcherBuilder threadAffinity​(List<ThreadAffinityConfigure> affinities)
        Sets optional thread affinity to the given configuration list . Thread affinity should be considered when using spinning thread type.
        Parameters:
        affinities - thread affinity configuration. May be null or empty.
        Returns:
        this dispatcher builder.
      • threadAffinity

        public EConfigure.DispatcherBuilder threadAffinity​(ThreadAffinityConfigure[] affinities)
        Sets optional thread affinity to the given configuration list . Thread affinity should be considered when using spinning thread type.
        Parameters:
        affinities - thread affinity configuration. May be null or empty.
        Returns:
        this dispatcher builder.
      • build

        public EConfigure.Dispatcher build()
        Returns the eBus Dispatcher configuration built from the previously set parameters.
        Returns:
        an eBus Dispatcher configuration.
        Throws:
        com.typesafe.config.ConfigException - if either the Dispatcher name, Dispatcher type, or run queue thread type are not set, or if the Dispatcher is not marked as default and no classes were provided.