Class CoreGlobalConfig

java.lang.Object
com.iohao.net.framework.CoreGlobalConfig

public final class CoreGlobalConfig extends Object
Global configuration constants for the ionet core framework.
Since:
25.1
Author:
渔民小镇
date:
2025-08-24
  • Field Details

    • setting

      public final BarSkeletonSetting setting
      Global business framework settings.
    • netPubName

      public String netPubName
      Human-readable publication name derived from netId.
    • timeoutMillis

      public int timeoutMillis
      Default timeout in milliseconds for request-response operations.
    • cleanFrequency

      public int cleanFrequency
      Frequency in milliseconds for cleaning up expired futures.
    • enableFragmentAssembler

      public boolean enableFragmentAssembler
      Whether to enable the Aeron fragment assembler for large messages.

      Aeron fragments any message whose encoded length exceeds the MTU (Aeron's default MTU is 1408 bytes for both network and IPC), and the receiver can only reassemble such multi-fragment messages when this is enabled. Turn it on whenever a single message can exceed the MTU, i.e. roughly when the payload can exceed ~1.4 KB; otherwise oversized messages will not be reassembled correctly. It is enabled by default so large messages are handled safely.

    • fragmentLimit

      public int fragmentLimit
      Maximum number of fragments to assemble per poll operation.
    • publisherBufferSize

      public int publisherBufferSize
      Buffer size in bytes for the Aeron publisher.

      This is the encoding-side upper bound and defaults to 64 KiB. The effective message cap is the minimum of this buffer size, the relevant SBE field limit, and the Aeron publication's maximum message length. Different projects can tune this value without regenerating the SBE codecs up to the payload field's 8 MiB minus 4 KiB schema ceiling.

      The buffer must hold the whole encoded message, not just the payload: the SBE message header plus fixed fields and each variable-data length prefix add roughly 100+ bytes of overhead (more if an attachment is present). So the maximum usable payload is this buffer size minus that overhead - size this value with headroom above your largest payload, never exactly equal.

      Upper bound: Aeron's maximum message length is min(termBufferLength / 8, 16 MiB), which is 8 MiB with Aeron's default 64 MiB IPC term buffer. Do not exceed 8 MiB unless the Aeron IPC term buffer length is increased accordingly. Also note that any value above the MTU (~1.4 KB) means large messages get fragmented, so enableFragmentAssembler must be enabled.

    • publisherQueueCapacity

      public int publisherQueueCapacity
      Maximum queued messages per Aeron publication; values less than or equal to 0 use an unbounded queue.
    • publisherDrainLimit

      public int publisherDrainLimit
      Maximum messages drained per publication per publisher loop; values less than or equal to 0 drain all.
    • publisherOfferRetryLimit

      public int publisherOfferRetryLimit
      Maximum retry attempts for retryable Aeron offer failures; 0 disables retry and values less than 0 retry indefinitely.
    • publisherIdleMaxSpins

      public int publisherIdleMaxSpins
      Maximum spin iterations for publisher idle backoff.
    • publisherIdleMaxYields

      public int publisherIdleMaxYields
      Maximum yield iterations for publisher idle backoff.
    • publisherIdleMinParkNanos

      public long publisherIdleMinParkNanos
      Minimum park duration in nanoseconds for publisher idle backoff.
    • publisherIdleMaxParkNanos

      public long publisherIdleMaxParkNanos
      Maximum park duration in nanoseconds for publisher idle backoff.
    • devMode

      public boolean devMode
      Whether development mode is enabled, providing extra diagnostics.
    • broadcastTrace

      public BroadcastTrace broadcastTrace
      Broadcast trace hook used to record diagnostic information when broadcast messages are sent.
  • Constructor Details

    • CoreGlobalConfig

      public CoreGlobalConfig()
  • Method Details

    • setNetId

      public void setNetId(int netId)
      Set the network ID. Must be greater than 1000.
      Parameters:
      netId - the network ID to set
    • getFutureTimeoutMillis

      public int getFutureTimeoutMillis()
      Get the future timeout in milliseconds, with a 200ms buffer added to the base timeout.
      Returns:
      the timeout value in milliseconds