Class LoomClient.Builder
- Enclosing class:
LoomClient
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd a seed address to the cluster.asyncStart(boolean on) Enable asynchronous startup.Configure gateway-forwarded auth credentials.build()Set periodic client statistics upload configuration.clientStatisticsEnabled(boolean enabled) Enable or disable periodic client statistics uploads.clientStatisticsUploadInterval(Duration interval) Set the interval for periodic client statistics uploads.Set connection timeout.credentialsFactory(CredentialsFactory factory) Configure a credentials factory for AUTH handshakes.maxInFlightRequests(int max) Set the maximum number of client requests tracked as in-flight.maxRetries(int n) Set max retry attempts for failed requests.nearCacheEnabled(boolean on) Enable or disable the local near cache.Set the capacity eviction policy for the near cache.Set how local writes update the near cache.nearCacheMaxSize(int max) Set near cache max entries.Set keys-only near-cache preloader persistence.Set periodic near-cache anti-entropy reconciliation.nearCacheSerializeKeys(boolean serializeKeys) Store near-cache keys using their serialized byte form.Set near cache time-to-live.Set reconnect behavior after the last member connection is lost.registerClass(Class<?> clazz, int id) Register an application class with the client Kryo serializer.registerClass(Class<T> clazz, int id, com.esotericsoftware.kryo.Serializer<? super T> serializer) Register an application class with a class-specific Kryo serializer.Set request timeout.Set base delay between retries.routingMemberGroup(String memberGroup) Select the configured member group used byClientRoutingMode.MULTI_MEMBER.routingMode(ClientRoutingMode mode) Set cluster routing mode.Set the IP/CIDR member-group definitions used byClientRoutingMode.MULTI_MEMBER.Add multiple seed addresses to the cluster.Add multiple seed addresses to the cluster.strictHandshake(boolean on) Opt into strict protocol-version handshake (BLK-2026-04-22-007 Day 1, Session 7 Sub-mission 2a).Set TLS configuration for secure connections.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
addSeed
Add a seed address to the cluster. Accepts IPv4host:port, hostnamehost:port, and bracketed IPv6[::1]:port. -
seeds
Add multiple seed addresses to the cluster. Each address is validated viaaddSeed(String). -
seeds
Add multiple seed addresses to the cluster. Each address is validated viaaddSeed(String). -
connectionTimeout
Set connection timeout. -
requestTimeout
Set request timeout. -
maxRetries
Set max retry attempts for failed requests. -
retryBaseDelay
Set base delay between retries. -
maxInFlightRequests
Set the maximum number of client requests tracked as in-flight. -
routingMode
Set cluster routing mode. Defaults toClientRoutingMode.ALL_MEMBERS. -
routingMemberGroup
Select the configured member group used byClientRoutingMode.MULTI_MEMBER. -
routingPartitionGroupConfig
Set the IP/CIDR member-group definitions used byClientRoutingMode.MULTI_MEMBER. -
asyncStart
Enable asynchronous startup. When enabled,build()clients return fromLoomClient.connect()immediately and establish the first connection in the background. -
reconnectMode
Set reconnect behavior after the last member connection is lost. -
tlsConfig
Set TLS configuration for secure connections. -
auth
Configure gateway-forwarded auth credentials. The gateway validates JWT and forwards user identity + roles.- Parameters:
username- the authenticated username (from gateway's X-Auth-User)roles- comma-separated roles (from gateway's X-Auth-Roles), or password for direct JAAS auth
-
credentialsFactory
Configure a credentials factory for AUTH handshakes.The factory is invoked for each node connection that needs credentials, including reconnects and leader redirects. If both
auth(String, String)and a factory are configured, the factory takes precedence. -
nearCacheEnabled
Enable or disable the local near cache. -
nearCacheTtl
Set near cache time-to-live. -
nearCacheMaxSize
Set near cache max entries. -
nearCacheEvictionPolicy
Set the capacity eviction policy for the near cache. Defaults toNearCacheEvictionPolicy.LRU. -
nearCacheLocalUpdatePolicy
Set how local writes update the near cache. Defaults toNearCacheLocalUpdatePolicy.INVALIDATE. -
nearCachePreloaderConfig
Set keys-only near-cache preloader persistence. Disabled by default. -
nearCacheReconciliationConfig
Set periodic near-cache anti-entropy reconciliation. Enabled by default. -
clientStatisticsConfig
Set periodic client statistics upload configuration. Disabled by default. -
clientStatisticsEnabled
Enable or disable periodic client statistics uploads. -
clientStatisticsUploadInterval
Set the interval for periodic client statistics uploads. -
nearCacheSerializeKeys
Store near-cache keys using their serialized byte form. Disabled by default. -
strictHandshake
Opt into strict protocol-version handshake (BLK-2026-04-22-007 Day 1, Session 7 Sub-mission 2a). When enabled, aPROTOCOL_HELLO+PROTOCOL_HELLO_ACKexchange runs on each new connection before any request is sent. Peers whose version is incompatible per the staticProtocolNegotiator.COMPATIBILITY_MATRIXcause the connection to be closed with anIOExceptionso the client can move on to the next seed.Default:
false(v2.0 behaviour — no handshake). Callers deploying a rolling-upgrade window across v2.x minors should set this totrueso mixed-version clusters surface version drift immediately instead of failing later at first incompatible op.Session 8 ESC-1: the flag is now wired through to
ConnectionManager.createConfiguredSocketwhich invokesProtocolHandshake.performHandshake(java.net.Socket, java.util.EnumSet)on every newly-opened socket before the reader thread is started. Compatible peers transparently continue; incompatible peers cause the connect attempt to fail with an IOException and the client falls through to the next seed via its existing retry loop.- Parameters:
on- whether to enable strict handshake- Returns:
- this builder
-
registerClass
Register an application class with the client Kryo serializer.The same class and ID must be registered on every server node that may deserialize this payload.
-
registerClass
public <T> LoomClient.Builder registerClass(Class<T> clazz, int id, com.esotericsoftware.kryo.Serializer<? super T> serializer) Register an application class with a class-specific Kryo serializer.The class-specific serializer is resolved before Kryo's default class serializer. The same class, ID, and serializer must be registered on every server node that may deserialize this payload.
-
build
-