Class ChannelConfig.Builder

java.lang.Object
ru.pathcreator.pyc.rpc.core.ChannelConfig.Builder
Enclosing class:
ChannelConfig

public static final class ChannelConfig.Builder extends Object
Builder для создания ChannelConfig.

Builder used to create ChannelConfig instances.

  • Constructor Details

    • Builder

      public Builder()
      Создает builder с настройками по умолчанию.

      Creates a builder with default settings.

  • Method Details

    • localEndpoint

      public ChannelConfig.Builder localEndpoint(String v)
      Задает локальный endpoint канала.

      Sets the local channel endpoint.

      Parameters:
      v - локальный endpoint / local endpoint
      Returns:
      этот builder / this builder
    • remoteEndpoint

      public ChannelConfig.Builder remoteEndpoint(String v)
      Задает удаленный endpoint канала.

      Sets the remote channel endpoint.

      Parameters:
      v - удаленный endpoint / remote endpoint
      Returns:
      этот builder / this builder
    • streamId

      public ChannelConfig.Builder streamId(int v)
      Задает Aeron stream id.

      Sets the Aeron stream id.

      Parameters:
      v - stream id / stream id
      Returns:
      этот builder / this builder
    • sessionId

      public ChannelConfig.Builder sessionId(int v)
      Задает Aeron session id.

      Sets the Aeron session id.

      Parameters:
      v - session id; 0 позволяет Aeron выбрать значение / session id; 0 lets Aeron choose the value
      Returns:
      этот builder / this builder
    • mtuLength

      public ChannelConfig.Builder mtuLength(int v)
      Задает MTU канала.

      Sets the channel MTU length.

      Parameters:
      v - MTU в байтах / MTU length in bytes
      Returns:
      этот builder / this builder
    • termLength

      public ChannelConfig.Builder termLength(int v)
      Задает длину term buffer.

      Sets the term buffer length.

      Parameters:
      v - длина term buffer в байтах / term buffer length in bytes
      Returns:
      этот builder / this builder
    • socketSndBuf

      public ChannelConfig.Builder socketSndBuf(int v)
      Задает размер socket send buffer.

      Sets the socket send buffer size.

      Parameters:
      v - размер send buffer в байтах / send buffer size in bytes
      Returns:
      этот builder / this builder
    • socketRcvBuf

      public ChannelConfig.Builder socketRcvBuf(int v)
      Задает размер socket receive buffer.

      Sets the socket receive buffer size.

      Parameters:
      v - размер receive buffer в байтах / receive buffer size in bytes
      Returns:
      этот builder / this builder
    • defaultTimeout

      public ChannelConfig.Builder defaultTimeout(Duration v)
      Задает таймаут RPC-вызова по умолчанию.

      Sets the default RPC call timeout.

      Parameters:
      v - таймаут вызова / call timeout
      Returns:
      этот builder / this builder
    • offerTimeout

      public ChannelConfig.Builder offerTimeout(Duration v)
      Задает таймаут ожидания отправки при backpressure.

      Sets the offer timeout used while handling backpressure.

      Parameters:
      v - таймаут offer / offer timeout
      Returns:
      этот builder / this builder
    • heartbeatInterval

      public ChannelConfig.Builder heartbeatInterval(Duration v)
      Задает интервал heartbeat.

      Sets the heartbeat interval.

      Parameters:
      v - интервал heartbeat / heartbeat interval
      Returns:
      этот builder / this builder
    • heartbeatMissedLimit

      public ChannelConfig.Builder heartbeatMissedLimit(int v)
      Задает допустимое число пропущенных heartbeat-интервалов.

      Sets the allowed number of missed heartbeat intervals.

      Parameters:
      v - лимит пропущенных heartbeat / missed heartbeat limit
      Returns:
      этот builder / this builder
    • maxMessageSize

      public ChannelConfig.Builder maxMessageSize(int v)
      Задает максимальный размер сообщения.

      Sets the maximum message size.

      Parameters:
      v - максимальный размер сообщения в байтах / maximum message size in bytes
      Returns:
      этот builder / this builder
    • backpressurePolicy

      public ChannelConfig.Builder backpressurePolicy(BackpressurePolicy v)
      Задает политику обработки backpressure.

      Sets the backpressure handling policy.

      Parameters:
      v - политика backpressure / backpressure policy
      Returns:
      этот builder / this builder
    • reconnectStrategy

      public ChannelConfig.Builder reconnectStrategy(ReconnectStrategy v)
      Sets how the channel should behave when a call begins or a publish attempt occurs while the underlying transport is not connected.

      Use ReconnectStrategy.FAIL_FAST when the caller should immediately trigger fallback logic. Use ReconnectStrategy.WAIT_FOR_CONNECTION when short reconnect windows are acceptable and the request should wait for the current Aeron path to recover.

      Parameters:
      v - reconnect strategy
      Returns:
      this builder
    • protocolHandshakeEnabled

      public ChannelConfig.Builder protocolHandshakeEnabled(boolean v)
      Enables or disables the optional protocol compatibility handshake.

      When enabled, the first outbound call performs one control-plane handshake with the peer and verifies version/capabilities before user traffic proceeds. This adds cost only to the first contact and remains disabled by default.

      Parameters:
      v - true to enable the protocol handshake
      Returns:
      this builder
    • protocolVersion

      public ChannelConfig.Builder protocolVersion(int v)
      Sets the local protocol version advertised by this channel.
      Parameters:
      v - local protocol version
      Returns:
      this builder
    • protocolCapabilities

      public ChannelConfig.Builder protocolCapabilities(long v)
      Sets the local capability bitmask advertised by this channel.
      Parameters:
      v - local capability bitmask
      Returns:
      this builder
    • requiredRemoteCapabilities

      public ChannelConfig.Builder requiredRemoteCapabilities(long v)
      Sets the capability bitmask that must be present on the remote side when the optional protocol handshake is enabled.
      Parameters:
      v - required remote capabilities
      Returns:
      this builder
    • protocolHandshakeTimeout

      public ChannelConfig.Builder protocolHandshakeTimeout(Duration v)
      Sets the timeout used by the optional protocol handshake.
      Parameters:
      v - handshake timeout
      Returns:
      this builder
    • listener

      Adds an optional listener for channel events.

      Listeners are opt-in. When none are configured, the fast path remains unchanged except for a single empty-array check before dispatching events.

      Parameters:
      v - listener to add
      Returns:
      this builder
    • rxIdleStrategy

      public ChannelConfig.Builder rxIdleStrategy(IdleStrategyKind v)
      Задает idle-стратегию rx-потока.

      Sets the receive thread idle strategy.

      Parameters:
      v - idle-стратегия / idle strategy
      Returns:
      этот builder / this builder
    • pendingPoolCapacity

      public ChannelConfig.Builder pendingPoolCapacity(int v)
      Задает емкость пула ожидающих вызовов.

      Sets the pending call pool capacity.

      Parameters:
      v - емкость pending-пула / pending pool capacity
      Returns:
      этот builder / this builder
    • registryInitialCapacity

      public ChannelConfig.Builder registryInitialCapacity(int v)
      Задает начальную емкость реестра ожидающих вызовов.

      Sets the initial capacity of the pending call registry.

      Parameters:
      v - начальная емкость реестра / registry initial capacity
      Returns:
      этот builder / this builder
    • offloadExecutor

      public ChannelConfig.Builder offloadExecutor(ExecutorService v)
      Задает executor для offload-обработчиков.

      Sets the executor used for offloaded handlers.

      Parameters:
      v - executor; null означает node-default executor / executor; null means the node-default executor
      Returns:
      этот builder / this builder
    • offloadTaskPoolSize

      public ChannelConfig.Builder offloadTaskPoolSize(int v)
      Задает размер пула offload-задач.

      Sets the offload task pool size.

      Parameters:
      v - размер пула задач / task pool size
      Returns:
      этот builder / this builder
    • offloadCopyPoolSize

      public ChannelConfig.Builder offloadCopyPoolSize(int v)
      Задает размер пула буферов копирования для offload.

      Sets the offload copy buffer pool size.

      Parameters:
      v - размер пула copy-буферов / copy buffer pool size
      Returns:
      этот builder / this builder
    • offloadCopyBufferSize

      public ChannelConfig.Builder offloadCopyBufferSize(int v)
      Задает размер одного буфера копирования для offload.

      Sets the size of one offload copy buffer.

      Parameters:
      v - размер copy-буфера в байтах / copy buffer size in bytes
      Returns:
      этот builder / this builder
    • offloadExecutionStatePoolingEnabled

      public ChannelConfig.Builder offloadExecutionStatePoolingEnabled(boolean v)
      Enables or disables pooled reusable execution state for offloaded handler execution.
      Parameters:
      v - true to enable execution-state pooling
      Returns:
      this builder
    • offloadExecutionStatePoolSize

      public ChannelConfig.Builder offloadExecutionStatePoolSize(int v)
      Sets the number of reusable offload execution states retained per channel in the steady state.
      Parameters:
      v - retained offload execution state pool size
      Returns:
      this builder
    • offloadExecutionStatePoolGrowthChunk

      public ChannelConfig.Builder offloadExecutionStatePoolGrowthChunk(int v)
      Sets how many additional offload execution states are created when the retained pool is temporarily exhausted.
      Parameters:
      v - temporary growth chunk for the offload execution state pool
      Returns:
      this builder
    • build

      public ChannelConfig build()
      Проверяет настройки и создает неизменяемую конфигурацию канала.

      Validates settings and builds an immutable channel configuration.

      Returns:
      конфигурация канала / channel configuration