Class ClusterConfig

java.lang.Object
com.loomcache.common.config.ClusterConfig

public final class ClusterConfig extends Object
Immutable cluster configuration. Every node and client gets one.

The clusterId maps to Hazelcast's cluster-name. It defaults to dev for Hazelcast 5.6 compatibility. Tests or multi-tenant local runs that need isolation should set an explicit UUID/string clusterId.

Builder pattern for clean construction.

  • Field Details

    • DEFAULT_CLUSTER_NAME

      public static final String DEFAULT_CLUSTER_NAME
      See Also:
    • DEFAULT_PORT

      public static final int DEFAULT_PORT
      See Also:
    • DEFAULT_HEARTBEAT_INTERVAL_MS

      public static final long DEFAULT_HEARTBEAT_INTERVAL_MS
      See Also:
    • DEFAULT_HEARTBEAT_TIMEOUT_MS

      public static final long DEFAULT_HEARTBEAT_TIMEOUT_MS
      See Also:
    • DEFAULT_SNAPSHOT_THRESHOLD

      public static final int DEFAULT_SNAPSHOT_THRESHOLD
      See Also:
    • DEFAULT_MAX_PARALLEL_MIGRATIONS

      public static final int DEFAULT_MAX_PARALLEL_MIGRATIONS
      See Also:
    • DEFAULT_MAX_EXECUTOR_TASK_PAYLOAD_BYTES

      public static final int DEFAULT_MAX_EXECUTOR_TASK_PAYLOAD_BYTES
      See Also:
    • DEFAULT_MAX_CONNECTIONS

      public static final int DEFAULT_MAX_CONNECTIONS
      See Also:
    • DEFAULT_TCP_READ_TIMEOUT_MS

      public static final int DEFAULT_TCP_READ_TIMEOUT_MS
      See Also:
    • DEFAULT_TCP_IDLE_TIMEOUT_MS

      public static final long DEFAULT_TCP_IDLE_TIMEOUT_MS
      See Also:
    • DEFAULT_GRACEFUL_SHUTDOWN_DRAIN_MS

      public static final long DEFAULT_GRACEFUL_SHUTDOWN_DRAIN_MS
      See Also:
    • DEFAULT_PIPELINED_EXECUTION

      public static final boolean DEFAULT_PIPELINED_EXECUTION
      See Also:
    • DEFAULT_COMMAND_QUEUE_CAPACITY

      public static final int DEFAULT_COMMAND_QUEUE_CAPACITY
      See Also:
    • DEFAULT_COMMAND_EXECUTOR_THREADS

      public static final int DEFAULT_COMMAND_EXECUTOR_THREADS
      See Also:
    • MIN_ID_GENERATOR_NODE_ID

      public static final int MIN_ID_GENERATOR_NODE_ID
      See Also:
    • MAX_ID_GENERATOR_NODE_ID

      public static final int MAX_ID_GENERATOR_NODE_ID
      See Also:
    • DEFAULT_PARTITION_GROUP_TYPE

      public static final PartitionGroupType DEFAULT_PARTITION_GROUP_TYPE
  • Method Details

    • clusterId

      public String clusterId()
    • nodeId

      public String nodeId()
    • host

      public String host()
    • bindAddress

      public String bindAddress()
    • port

      public int port()
    • instanceNumber

      public int instanceNumber()
    • idGeneratorNodeId

      public int idGeneratorNodeId()
      Stable 10-bit node identifier used by Snowflake-style ID generators. Must be unique across live cluster members.
    • idGeneratorNodeIdExplicit

      public boolean idGeneratorNodeIdExplicit()
      True when ClusterConfig.Builder.idGeneratorNodeId(int) was set explicitly.
    • seeds

      public List<String> seeds()
    • raftBootstrapServers

      public List<ClusterConfig.RaftBootstrapServer> raftBootstrapServers()
    • hasStaticRaftBootstrap

      public boolean hasStaticRaftBootstrap()
    • staticRaftBootstrapFingerprint

      public Optional<String> staticRaftBootstrapFingerprint()
    • discoveryConfig

      public DiscoveryConfig discoveryConfig()
    • heartbeatIntervalMs

      public long heartbeatIntervalMs()
    • heartbeatTimeoutMs

      public long heartbeatTimeoutMs()
    • icmpFailureDetectorConfig

      public IcmpFailureDetectorConfig icmpFailureDetectorConfig()
    • slowOperationDetectorConfig

      public SlowOperationDetectorConfig slowOperationDetectorConfig()
    • maxMemoryBytes

      public long maxMemoryBytes()
    • mapMaxEntries

      public int mapMaxEntries()
    • mapEvictionPolicy

      public String mapEvictionPolicy()
    • auditEnabled

      public boolean auditEnabled()
    • auditQueueCapacity

      public int auditQueueCapacity()
    • tlsConfig

      public TlsConfig tlsConfig()
    • endpointTlsConfig

      public EndpointTlsConfig endpointTlsConfig()
    • authConfig

      public AuthConfig authConfig()
    • dataDir

      public @Nullable String dataDir()
    • persistenceBackupDir

      public @Nullable String persistenceBackupDir()
    • persistenceHotBackupIntervalSeconds

      public long persistenceHotBackupIntervalSeconds()
    • idempotencyTtlMs

      public long idempotencyTtlMs()
      TTL for idempotency dedup cache entries in milliseconds. Defaults to 60,000 ms (1 minute).
      Returns:
      the idempotency TTL in milliseconds
    • shardingEnabled

      public boolean shardingEnabled()
      Whether multi-Raft-group sharding is enabled on this node.

      Default false — all writes replicate through a single Raft group ("raft-0") for backward compatibility. When enabled, keys are routed to one of numGroups() independent Raft groups based on hash(key).

      Returns:
      true when sharding mode is active
      Since:
      2.0
    • numGroups

      public int numGroups()
      Number of Raft groups to create when sharding is enabled.

      When shardingEnabled() is false, this value is ignored and the node always runs with a single group (numGroups=1). When sharding is enabled, this must be at least 2 (enforced at build time).

      Returns:
      the number of Raft groups (>= 1 when sharding disabled, >= 2 when enabled)
      Since:
      2.0
    • partitionGroupType

      public PartitionGroupType partitionGroupType()
    • partitionGroupConfig

      public PartitionGroupConfig partitionGroupConfig()
    • wanAcknowledgeType

      public WanAcknowledgeType wanAcknowledgeType()
    • wanPersistReplicatedData

      public boolean wanPersistReplicatedData()
    • clusterDataRecoveryPolicy

      public ClusterDataRecoveryPolicy clusterDataRecoveryPolicy()
    • snapshotThreshold

      public int snapshotThreshold()
    • persistenceValidationTimeoutSeconds

      public long persistenceValidationTimeoutSeconds()
    • persistenceDataLoadTimeoutSeconds

      public long persistenceDataLoadTimeoutSeconds()
    • persistenceRecoveryParallelism

      public int persistenceRecoveryParallelism()
    • maxParallelMigrations

      public int maxParallelMigrations()
    • maxExecutorTaskPayloadBytes

      public int maxExecutorTaskPayloadBytes()
    • readBackupData

      public boolean readBackupData()
    • maxConnections

      public int maxConnections()
    • tcpReadTimeoutMs

      public int tcpReadTimeoutMs()
    • tcpIdleTimeoutMs

      public long tcpIdleTimeoutMs()
    • gracefulShutdownDrainMs

      public long gracefulShutdownDrainMs()
    • pipelinedExecution

      public boolean pipelinedExecution()
    • commandQueueCapacity

      public int commandQueueCapacity()
    • commandExecutorThreads

      public int commandExecutorThreads()
    • queueConfigs

      public Map<String, QueueConfig> queueConfigs()
    • priorityQueueConfigs

      public Map<String, PriorityQueueConfig> priorityQueueConfigs()
    • dataConnectionConfigs

      public Map<String, DataConnectionConfig> dataConnectionConfigs()
    • genericMapStoreConfigs

      public Map<String, GenericMapStoreConfig> genericMapStoreConfigs()
    • address

      public String address()
      Convenience: "host:port" for this node.
    • builder

      public static ClusterConfig.Builder builder()
    • legacyIdGeneratorNodeId

      public static int legacyIdGeneratorNodeId(int instanceNumber)
    • validateIdGeneratorNodeId

      public static void validateIdGeneratorNodeId(int nodeId)
    • parseRaftBootstrapServer

      public static ClusterConfig.RaftBootstrapServer parseRaftBootstrapServer(String raw)
    • parseRaftBootstrapServers

      public static List<ClusterConfig.RaftBootstrapServer> parseRaftBootstrapServers(List<String> entries)