Class CacheNodeConfig
Configurable via application.properties: loomcache.cluster.node-id — unique node identifier loomcache.server.bind-address — bind host loomcache.node.port — bind port loomcache.node.instance — instance number (1, 2, or 3) for log prefix loomcache.cluster.seeds — comma-separated seed list (host:port) — REQUIRED, no default loomcache.cluster.id — cluster UUID (auto-generated if not set)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncacheNode(ClusterConfig clusterConfig, org.springframework.beans.factory.ObjectProvider<io.micrometer.core.instrument.MeterRegistry> meterRegistryProvider) Create and start the cache node bean.Create cluster configuration bean from properties.consistentHashRing(ClusterConfig clusterConfig) Create consistent hash ring bean.defaultAtomicLong(CacheNode cacheNode) defaultAtomicReference(CacheNode cacheNode) defaultCounter(CacheNode cacheNode) defaultList(CacheNode cacheNode) defaultLock(CacheNode cacheNode) defaultMap(CacheNode cacheNode, WriteThroughCacheStore cacheStore) Default distributed map with write-through wired up.defaultMultiMap(CacheNode cacheNode) defaultQueue(CacheNode cacheNode) Create default distributed queue bean, resolved from the node's registry so it shares state with the rest of the embedded server.defaultReliableTopic(CacheNode cacheNode) defaultRingbuffer(CacheNode cacheNode) defaultSet(CacheNode cacheNode) Create default distributed set bean, resolved from the node's registry so it shares state with the rest of the embedded server.defaultTopic(CacheNode cacheNode) Create default distributed topic bean, resolved from the node's registry so it shares state with the rest of the embedded server.replicationManager(CacheNode cacheNode, ConsistentHashRing hashRing) Create replication manager bean.writeThroughCacheStore(CacheEntryRepository repository) Create write-through cache store bean.
-
Constructor Details
-
CacheNodeConfig
-
-
Method Details
-
clusterConfig
Create cluster configuration bean from properties.- Returns:
- the cluster configuration
-
cacheNode
@Bean(destroyMethod="stop") @Conditional(LoomServerEnabledCondition.class) public CacheNode cacheNode(ClusterConfig clusterConfig, org.springframework.beans.factory.ObjectProvider<io.micrometer.core.instrument.MeterRegistry> meterRegistryProvider) throws Exception Create and start the cache node bean.BLK-2026-04-22-002: the Spring Boot Actuator MeterRegistry (which Spring auto-wires into a Prometheus-backed CompositeMeterRegistry when
micrometer-registry-prometheusis on the classpath) is now injected into CacheNode. Previously the single-arg constructor created a throw-awaySimpleMeterRegistry, so everyloomcache.*metric registered on the cache node never reached/actuator/prometheus. With this wiring, all Raft / WAL / cache metrics are scrapeable.- Parameters:
clusterConfig- the cluster configurationmeterRegistryProvider- provider for the Spring-managed MeterRegistry; resolves to the Prometheus-backed registry when actuator + Prometheus dependency are present, ornullotherwise- Returns:
- the started cache node
- Throws:
Exception- if startup fails
-
consistentHashRing
Create consistent hash ring bean.- Returns:
- the consistent hash ring
-
replicationManager
@Bean @Conditional(LoomServerEnabledCondition.class) public ReplicationManager replicationManager(CacheNode cacheNode, ConsistentHashRing hashRing) Create replication manager bean.- Parameters:
cacheNode- the cache nodehashRing- the consistent hash ring- Returns:
- the replication manager
-
writeThroughCacheStore
Create write-through cache store bean.- Parameters:
repository- the cache entry repository- Returns:
- the write-through cache store
-
defaultMap
@Bean @Conditional(LoomServerEnabledCondition.class) public DistributedMap<String,String> defaultMap(CacheNode cacheNode, WriteThroughCacheStore cacheStore) Default distributed map with write-through wired up.The bean is resolved from
so it is the same instance the embedded server uses for cluster routing, replication, and persistence. Creating a standaloneinvalid reference
CacheNode#getDataStructures()new DistributedMap(...)here would give the Spring context a look-alike that is disconnected from the node.Warm-up order: the persisted state is loaded and populated into the map BEFORE the write-through/delete-through callbacks are installed. This prevents the prior resurrect-tombstone race — under the old
ApplicationReadyEventwarm-up, a live DELETE could remove a key after the DB snapshot was read but before warm-up reached the key, and the subsequentputIfAbsentwould silently restore the deleted value. Bean creation is synchronous and happens before the Spring web server accepts traffic, so the HTTP side of the race is eliminated. The residual TCP-side window (CacheNode TCP already accepting as soon as thecacheNodebean is built) is unavoidable without a dedicated readiness gate and is kept narrow by running warm-up synchronously.- Parameters:
cacheNode- the embedded cache node whose registry owns the instancecacheStore- the write-through cache store- Returns:
- the distributed map registered under the name
"default"
-
defaultQueue
@Bean @Conditional(LoomServerEnabledCondition.class) public DistributedQueue<String> defaultQueue(CacheNode cacheNode) Create default distributed queue bean, resolved from the node's registry so it shares state with the rest of the embedded server.- Parameters:
cacheNode- the embedded cache node- Returns:
- the distributed queue registered under the name
"default"
-
defaultTopic
@Bean @Conditional(LoomServerEnabledCondition.class) public DistributedTopic<String> defaultTopic(CacheNode cacheNode) Create default distributed topic bean, resolved from the node's registry so it shares state with the rest of the embedded server.- Parameters:
cacheNode- the embedded cache node- Returns:
- the distributed topic registered under the name
"default"
-
defaultSet
@Bean @Conditional(LoomServerEnabledCondition.class) public DistributedSet<String> defaultSet(CacheNode cacheNode) Create default distributed set bean, resolved from the node's registry so it shares state with the rest of the embedded server. Required bySetController; without this bean, application startup fails with NoSuchBeanDefinitionException.- Parameters:
cacheNode- the embedded cache node- Returns:
- the distributed set registered under the name
"default"
-
defaultMultiMap
@Bean @Conditional(LoomServerEnabledCondition.class) public DistributedMultiMap defaultMultiMap(CacheNode cacheNode) -
defaultList
@Bean @Conditional(LoomServerEnabledCondition.class) public DistributedList<String> defaultList(CacheNode cacheNode) -
defaultRingbuffer
@Bean @Conditional(LoomServerEnabledCondition.class) public DistributedRingbuffer<String> defaultRingbuffer(CacheNode cacheNode) -
defaultReliableTopic
@Bean @Conditional(LoomServerEnabledCondition.class) public ReliableTopic<String> defaultReliableTopic(CacheNode cacheNode) -
defaultCounter
@Bean @Conditional(LoomServerEnabledCondition.class) public PNCounter defaultCounter(CacheNode cacheNode) -
defaultLock
@Bean @Conditional(LoomServerEnabledCondition.class) public LinearizableLock defaultLock(CacheNode cacheNode) -
defaultAtomicLong
@Bean @Conditional(LoomServerEnabledCondition.class) public LinearizableAtomicLong defaultAtomicLong(CacheNode cacheNode) -
defaultAtomicReference
@Bean @Conditional(LoomServerEnabledCondition.class) public LinearizableAtomicReference<String> defaultAtomicReference(CacheNode cacheNode)
-