Class BaseClientConfiguration.BaseClientConfigurationBuilder<C extends BaseClientConfiguration,B extends BaseClientConfiguration.BaseClientConfigurationBuilder<C,B>>
- java.lang.Object
-
- glide.api.models.configuration.BaseClientConfiguration.BaseClientConfigurationBuilder<C,B>
-
- Direct Known Subclasses:
GlideClientConfiguration.GlideClientConfigurationBuilder,GlideClusterClientConfiguration.GlideClusterClientConfigurationBuilder
- Enclosing class:
- BaseClientConfiguration
public abstract static class BaseClientConfiguration.BaseClientConfigurationBuilder<C extends BaseClientConfiguration,B extends BaseClientConfiguration.BaseClientConfigurationBuilder<C,B>> extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description BaseClientConfigurationBuilder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Baddress(NodeAddress address)Baddresses(java.util.Collection<? extends NodeAddress> addresses)abstract Cbuild()BclearAddresses()BclientAZ(java.lang.String clientAZ)Availability Zone of the client.BclientName(java.lang.String clientName)Client name to be used for the client.Bcredentials(ServerCredentials credentials)Credentials for authentication process.BdatabaseId(java.lang.Integer databaseId)Index of the logical database to connect to.BinflightRequestsLimit(java.lang.Integer inflightRequestsLimit)The maximum number of concurrent requests allowed to be in-flight (sent but not yet completed).BlazyConnect(boolean lazyConnect)Enables lazy connection mode, where physical connections to the server(s) are deferred until the first command is sent.BlibName(java.lang.String libName)Library name to be used for the client.Bprotocol(ProtocolVersion protocol)Serialization protocol to be used with the server.BreadFrom(@NonNull ReadFrom readFrom)Represents the client's read from strategy.BreconnectStrategy(BackoffStrategy reconnectStrategy)Strategy used to determine how and when to reconnect, in case of connection failures.BrequestTimeout(java.lang.Integer requestTimeout)The duration in milliseconds that the client should wait for a request to complete.protected abstract Bself()java.lang.StringtoString()BuseTLS(boolean useTLS)True if communication with the cluster should use Transport Level Security.
-
-
-
Method Detail
-
address
public B address(NodeAddress address)
-
addresses
public B addresses(java.util.Collection<? extends NodeAddress> addresses)
-
clearAddresses
public B clearAddresses()
-
useTLS
public B useTLS(boolean useTLS)
True if communication with the cluster should use Transport Level Security.If the server/cluster requires TLS, not setting this will cause the connection attempt to fail.
If the server/cluster doesn't require TLS, setting this will also cause the connection attempt to fail.
- Returns:
this.
-
readFrom
public B readFrom(@NonNull @NonNull ReadFrom readFrom)
Represents the client's read from strategy.- Returns:
this.
-
credentials
public B credentials(ServerCredentials credentials)
Credentials for authentication process. If none are set, the client will not authenticate itself with the server.- Returns:
this.
-
requestTimeout
public B requestTimeout(java.lang.Integer requestTimeout)
The duration in milliseconds that the client should wait for a request to complete. This duration encompasses sending the request, awaiting for a response from the server, and any required reconnection or retries. If the specified timeout is exceeded for a pending request, it will result in a timeout error. If not explicitly set, a default value of 250 milliseconds will be used.- Returns:
this.
-
clientName
public B clientName(java.lang.String clientName)
Client name to be used for the client. Will be used with CLIENT SETNAME command during connection establishment.- Returns:
this.
-
libName
public B libName(java.lang.String libName)
Library name to be used for the client. Will be used with CLIENT SETINFO LIB-NAME command during connection establishment.- Returns:
this.
-
protocol
public B protocol(ProtocolVersion protocol)
Serialization protocol to be used with the server. If not set,ProtocolVersion.RESP3will be used.- Returns:
this.
-
inflightRequestsLimit
public B inflightRequestsLimit(java.lang.Integer inflightRequestsLimit)
The maximum number of concurrent requests allowed to be in-flight (sent but not yet completed). This limit is used to control the memory usage and prevent the client from overwhelming the server or getting stuck in case of a queue backlog. If not set, a default value of 1000 will be used.- Returns:
this.
-
clientAZ
public B clientAZ(java.lang.String clientAZ)
Availability Zone of the client. If ReadFrom strategy is AZAffinity or AZAffinityReplicasAndPrimary, this setting ensures that readonly commands are directed to nodes within the specified AZ if exits.- Returns:
this.
-
reconnectStrategy
public B reconnectStrategy(BackoffStrategy reconnectStrategy)
Strategy used to determine how and when to reconnect, in case of connection failures.- Returns:
this.
-
databaseId
public B databaseId(java.lang.Integer databaseId)
Index of the logical database to connect to. Must be non-negative and within the range supported by the server configuration. If not specified, defaults to database 0.- Returns:
this.
-
lazyConnect
public B lazyConnect(boolean lazyConnect)
Enables lazy connection mode, where physical connections to the server(s) are deferred until the first command is sent. This can reduce startup latency and allow for client creation in disconnected environments.When set to
true, the client will not attempt to connect to the specified nodes during initialization. Instead, connections will be established only when a command is actually executed.Note that the first command executed with lazy connections may experience additional latency as it needs to establish the connection first. During this initial connection, the standard request timeout does not apply yet - instead, the connection establishment is governed by
connectionTimeout. The request timeout (requestTimeout) only begins counting after the connection has been successfully established. This behavior can effectively increase the total time needed for the first command to complete.This setting applies to both standalone and cluster modes. Note that if an operation is attempted and connection fails (e.g., unreachable nodes), errors will surface at that point.
If not set, connections are established immediately during client creation (equivalent to
false).- Returns:
this.
-
self
protected abstract B self()
-
build
public abstract C build()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-