Class EConfigure.ThreadBuilder<T extends EConfigure.ThreadConfig,​B extends EConfigure.ThreadBuilder>

    • Field Detail

      • mNumThreads

        protected int mNumThreads
      • mName

        protected String mName
      • mSpinLimit

        protected long mSpinLimit
      • mParkTime

        protected Duration mParkTime
      • mPriority

        protected int mPriority
    • Constructor Detail

      • ThreadBuilder

        protected ThreadBuilder​(int numThreads)
    • Method Detail

      • self

        protected abstract B self()
        Returns subclass this reference.
        Returns:
        this.
      • buildImpl

        protected abstract T buildImpl()
        Returns new subclass instance based on builder settings.
        Returns:
        new subclass instance.
      • configuration

        public B configuration​(T config)
      • name

        public final B name​(String name)
        Sets scheduled executor name. Used to create thread name.
        Parameters:
        name - scheduled executor name.
        Returns:
        this thread builder.
        Throws:
        com.typesafe.config.ConfigException - if name is null or empty.
      • spinLimit

        public final B spinLimit​(long limit)
        Sets the ThreadType.SPINPARK or ThreadType.SPINYIELD spin limit. This setting is ignored for any other run queue thread type.
        Parameters:
        limit - spin limit.
        Returns:
        this thread builder.
        Throws:
        com.typesafe.config.ConfigException - if limit < zero.
      • parkTime

        public final B 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 thread builder.
        Throws:
        com.typesafe.config.ConfigException - if time is null or < zero.
      • priority

        public final B priority​(int priority)
        Sets the thread priority. Must be ≥ Thread.MIN_PRIORITY and ≤ Thread.MAX_PRIORITY.
        Parameters:
        priority - assigned thread priority for scheduled executor thread.
        Returns:
        this thread builder.
        Throws:
        com.typesafe.config.ConfigException - if priority < zero or > Thread.MAX_PRIORITY.
      • threadAffinity

        public final B 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 thread builder.
      • threadAffinity

        public final B 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 thread builder.
      • build

        public T build()
        Returns the target configuration instance built from previously set parameters.
        Returns:
        an eBus thread configuration subclass instance.
        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.
      • validate

        protected Validator validate​(Validator problems)
        Validates the Dispatcher builder parameters. 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.