Class ChannelConfig

java.lang.Object
ru.pathcreator.pyc.rpc.core.ChannelConfig

public final class ChannelConfig extends Object
Конфигурация одного RPC-канала.

Класс описывает транспортный профиль канала: локальный и удаленный Aeron endpoint, stream/session id, таймауты, heartbeat, backpressure policy, receive idle strategy, режим выполнения handler-ов и опциональные сервисные надстройки вроде protocol handshake и listeners.

Configuration of a single RPC channel. It describes the Aeron endpoints, stream/session ids, timeouts, heartbeat behavior, backpressure policy, receive idle strategy, handler execution mode, and optional service-level features such as protocol handshake and listeners.

Основные группы настроек / Main setting groups

  • Сеть / Network: localEndpoint, remoteEndpoint, streamId, optional sessionId.
  • Таймауты / Timeouts: default RPC timeout, publication offer timeout, heartbeat interval and failure threshold.
  • Прием / Receive path: rxIdleStrategy() controls how the RX loop behaves while idle.
  • Обработка / Handler execution: offloadExecutor() decides whether server handlers run in an executor or directly in the RX path.
  • Совместимость / Compatibility: protocol version, capability bits, and optional handshake timeout.
  • Наблюдаемость / Observability: optional RpcChannelListener callbacks.
  • Field Details

    • DEFAULT_MAX_MESSAGE_SIZE

      public static final int DEFAULT_MAX_MESSAGE_SIZE
      Максимальный размер одного transport message по умолчанию, 16 MiB.

      Default maximum size of one transport message, 16 MiB.

      See Also:
    • DIRECT_EXECUTOR

      public static final ExecutorService DIRECT_EXECUTOR
      Маркерное значение для режима "выполнять handler прямо в RX-пути".

      Marker value for the "execute the handler directly in the RX path" mode.

      Используется через ChannelConfig.Builder.offloadExecutor(ExecutorService): если передать DIRECT_EXECUTOR, канал не будет offload-ить обработчик в executor и вызовет его прямо из receive path.

      Use it via ChannelConfig.Builder.offloadExecutor(ExecutorService). When configured, the channel does not offload the handler and invokes it directly from the receive path.

      Это минимизирует latency, но блокирует прием на время работы handler-а, поэтому режим подходит только для гарантированно коротких обработчиков.

      This minimizes latency, but receive progress is blocked while the handler runs, so the mode is suitable only for guaranteed short handlers.

  • Method Details

    • localEndpoint

      public String localEndpoint()
      Возвращает локальный UDP endpoint канала.

      Returns the local UDP endpoint of the channel.

      Returns:
      локальный endpoint / local endpoint
    • remoteEndpoint

      public String remoteEndpoint()
      Возвращает удаленный UDP endpoint канала.

      Returns the remote UDP endpoint of the channel.

      Returns:
      удаленный endpoint / remote endpoint
    • streamId

      public int streamId()
      Возвращает Aeron stream id.

      Returns the Aeron stream id.

      Returns:
      stream id / stream id
    • sessionId

      public int sessionId()
      Возвращает Aeron session id.

      Returns the Aeron session id.

      Returns:
      session id; 0 означает выбор Aeron / session id; 0 means Aeron-selected
    • mtuLength

      public int mtuLength()
      Возвращает MTU канала.

      Returns the channel MTU length.

      Returns:
      MTU в байтах / MTU length in bytes
    • termLength

      public int termLength()
      Возвращает длину term buffer.

      Returns the term buffer length.

      Returns:
      длина term buffer в байтах / term buffer length in bytes
    • socketSndBuf

      public int socketSndBuf()
      Возвращает размер socket send buffer.

      Returns the socket send buffer size.

      Returns:
      размер send buffer в байтах / send buffer size in bytes
    • socketRcvBuf

      public int socketRcvBuf()
      Возвращает размер socket receive buffer.

      Returns the socket receive buffer size.

      Returns:
      размер receive buffer в байтах / receive buffer size in bytes
    • defaultTimeout

      public Duration defaultTimeout()
      Возвращает таймаут RPC-вызова по умолчанию.

      Returns the default RPC call timeout.

      Returns:
      таймаут вызова по умолчанию / default call timeout
    • offerTimeout

      public Duration offerTimeout()
      Возвращает таймаут ожидания отправки при backpressure.

      Returns the offer timeout used while handling backpressure.

      Returns:
      таймаут offer / offer timeout
    • heartbeatInterval

      public Duration heartbeatInterval()
      Возвращает интервал heartbeat.

      Returns the heartbeat interval.

      Returns:
      интервал heartbeat / heartbeat interval
    • heartbeatMissedLimit

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

      Returns the allowed number of missed heartbeat intervals.

      Returns:
      лимит пропущенных heartbeat / missed heartbeat limit
    • maxMessageSize

      public int maxMessageSize()
      Возвращает максимальный размер сообщения.

      Returns the maximum message size.

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

      public BackpressurePolicy backpressurePolicy()
      Возвращает политику обработки backpressure.

      Returns the backpressure handling policy.

      Returns:
      политика backpressure / backpressure policy
    • reconnectStrategy

      public ReconnectStrategy reconnectStrategy()
      Returns the reconnect behavior used when a call starts or a publish attempt happens while the channel is temporarily disconnected.

      ReconnectStrategy.FAIL_FAST preserves the old behavior and fails immediately. ReconnectStrategy.WAIT_FOR_CONNECTION waits for the existing Aeron publication and heartbeat path to become connected again within the call timeout.

      Returns:
      reconnect strategy for this channel
    • protocolHandshakeEnabled

      public boolean protocolHandshakeEnabled()
      Returns whether the optional protocol compatibility handshake is enabled.
      Returns:
      true if the handshake is enabled
    • protocolVersion

      public int protocolVersion()
      Returns the local protocol version advertised by this channel.
      Returns:
      local protocol version
    • protocolCapabilities

      public long protocolCapabilities()
      Returns the local capability bitmask advertised by this channel.
      Returns:
      local protocol capabilities
    • requiredRemoteCapabilities

      public long requiredRemoteCapabilities()
      Returns the required remote capability bits when the optional handshake is enabled.
      Returns:
      required remote capabilities
    • protocolHandshakeTimeout

      public Duration protocolHandshakeTimeout()
      Returns the timeout used by the optional protocol handshake.
      Returns:
      protocol handshake timeout
    • listeners

      public RpcChannelListener[] listeners()
      Returns the configured optional channel listeners.
      Returns:
      channel listeners, possibly empty
    • rxIdleStrategy

      public IdleStrategyKind rxIdleStrategy()
      Возвращает idle-стратегию rx-потока.

      Returns the receive thread idle strategy.

      Returns:
      idle-стратегия rx-потока / receive idle strategy
    • pendingPoolCapacity

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

      Returns the pending call pool capacity.

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

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

      Returns the initial capacity of the pending call registry.

      Returns:
      начальная емкость реестра / registry initial capacity
    • offloadExecutor

      public ExecutorService offloadExecutor()
      Возвращает executor для offload-обработчиков.

      Returns the executor used for offloaded handlers.

      Returns:
      executor или null для node-default executor / executor or null for the node-default executor
    • offloadTaskPoolSize

      public int offloadTaskPoolSize()
      Возвращает размер пула offload-задач.

      Returns the offload task pool size.

      Returns:
      размер пула offload-задач / offload task pool size
    • offloadCopyPoolSize

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

      Returns the offload copy buffer pool size.

      Returns:
      размер пула copy-буферов / copy buffer pool size
    • offloadCopyBufferSize

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

      Returns the size of one offload copy buffer.

      Returns:
      размер copy-буфера в байтах / copy buffer size in bytes
    • offloadExecutionStatePoolingEnabled

      public boolean offloadExecutionStatePoolingEnabled()
      Returns whether pooled reusable execution state should be used for offloaded handlers.
      Returns:
      true when offload execution state pooling is enabled
    • offloadExecutionStatePoolSize

      public int offloadExecutionStatePoolSize()
      Returns the number of reusable offload execution states retained per channel in the steady state.
      Returns:
      retained offload execution state pool size
    • offloadExecutionStatePoolGrowthChunk

      public int offloadExecutionStatePoolGrowthChunk()
      Returns how many additional offload execution states should be created when the retained pool is temporarily exhausted.
      Returns:
      growth chunk for temporary pool expansion
    • isDirectExecutor

      public boolean isDirectExecutor()
      Проверяет, настроено ли выполнение обработчиков прямо в rx-потоке.

      Checks whether handlers are configured to run directly in the receive thread.

      Returns:
      true, если используется DIRECT_EXECUTOR / true when DIRECT_EXECUTOR is used
    • builder

      public static ChannelConfig.Builder builder()
      Создает builder конфигурации канала.

      Creates a channel configuration builder.

      Returns:
      новый builder / new builder