Class TransportConfig.Builder

java.lang.Object
express.mvp.myra.transport.TransportConfig.Builder
Enclosing class:
TransportConfig

public static final class TransportConfig.Builder extends Object
Builder for constructing TransportConfig instances.

All parameters have sensible defaults. Only override what you need.\n

  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • backendType

      public TransportConfig.Builder backendType(TransportConfig.BackendType backendType)
      Sets the I/O backend type.
      Parameters:
      backendType - the backend to use
      Returns:
      this builder for chaining
      Throws:
      NullPointerException - if backendType is null
    • registeredBuffers

      Sets the registered buffer pool configuration.
      Parameters:
      config - the buffer configuration
      Returns:
      this builder for chaining
      Throws:
      NullPointerException - if config is null
    • connectionTimeout

      public TransportConfig.Builder connectionTimeout(Duration timeout)
      Sets the TCP connection timeout.
      Parameters:
      timeout - the connection timeout
      Returns:
      this builder for chaining
      Throws:
      NullPointerException - if timeout is null
    • cpuAffinity

      public TransportConfig.Builder cpuAffinity(int cpuId)
      Sets the CPU affinity for the I/O thread.
      Parameters:
      cpuId - the CPU core to pin to, or -1 for no affinity
      Returns:
      this builder for chaining
    • sqPollCpuAffinity

      public TransportConfig.Builder sqPollCpuAffinity(int cpuId)
      Sets the CPU affinity for the SQPOLL kernel thread.

      Only used when sqPollEnabled(boolean) is true.

      Parameters:
      cpuId - the CPU core to pin to, or -1 for no affinity
      Returns:
      this builder for chaining
    • sqPollEnabled

      public TransportConfig.Builder sqPollEnabled(boolean enabled)
      Enables or disables SQPOLL mode.

      SQPOLL creates a dedicated kernel thread for submission polling, eliminating syscall overhead. Uses one CPU core continuously.

      Parameters:
      enabled - true to enable SQPOLL
      Returns:
      this builder for chaining
    • sqPollIdleTimeout

      public TransportConfig.Builder sqPollIdleTimeout(int millis)
      Sets the SQPOLL idle timeout.
      Parameters:
      millis - idle timeout in milliseconds before kernel thread sleeps
      Returns:
      this builder for chaining
    • build

      public TransportConfig build()
      Builds the configuration.
      Returns:
      a new immutable TransportConfig