Class ENetConfigure.SelectorInfoBuilder

  • Enclosing class:
    ENetConfigure

    public static final class ENetConfigure.SelectorInfoBuilder
    extends Object
    Constructs an ENetConfigure.SelectorInfo instance based on the parameters set via the builder's API. The minimally allowed configuration is based on the selector's thread type. In all cases a unique selector name and type must be provided. The selector parameters are:

    Example building a SelectorInfo

     final ENetConfigure.SelectorInfoBuilder builder = ENetConfigure.selectorBuilder();
     final ENetConfigure.SelectorInfo selectorInfo = builder.name("app_selector")
                                                            .type(ThreadType.SPINPARK)
                                                            .isDefault(true)
                                                            .spinLimit(2_000_000L)
                                                            .parkTime(500L)
                                                            .build();
    • Method Detail

      • name

        public ENetConfigure.SelectorInfoBuilder name​(String name)
        Sets the selector name to the given value.
        Parameters:
        name - selector name.
        Returns:
        this SelectorInfoBuilder.
        Throws:
        com.typesafe.config.ConfigException - if name is either null or an empty string.
      • type

        public ENetConfigure.SelectorInfoBuilder type​(ThreadType type)
        Sets the selector thread type to the given value.
        Parameters:
        type - selector thread type.
        Returns:
        this SelectorInfoBuilder.
        Throws:
        com.typesafe.config.ConfigException - if type is null.
      • isDefault

        public ENetConfigure.SelectorInfoBuilder isDefault​(boolean flag)
        Sets the selector flag marking whether this is the default selector or not.
        Parameters:
        flag - true if this is the default selector thread.
        Returns:
        this SelectorInfoBuilder.
      • spinLimit

        public ENetConfigure.SelectorInfoBuilder spinLimit​(long limit)
        Sets a spinning selector thread's spin limit.
        Parameters:
        limit - number of time the thread may spin on select before parking.
        Returns:
        this SelectorInfoBuilder.
        Throws:
        com.typesafe.config.ConfigException - if limit is ≤ zero.
      • parkTime

        public ENetConfigure.SelectorInfoBuilder parkTime​(Duration time)
        Sets a spin+park selector thread's park time.
        Parameters:
        time - nanosecond thread park time.
        Returns:
        this SelectorInfoBuilder.
        Throws:
        com.typesafe.config.ConfigException - if time is null or ≤ zero.