public static class MultiDbConfig.DatabaseConfig
extends java.lang.Object
Each DatabaseConfig represents a single Redis endpoint that can participate in the multi-database failover system. It encapsulates the connection details, weight for priority-based selection, and health check configuration for that endpoint.
| Modifier and Type | Class and Description |
|---|---|
static class |
MultiDbConfig.DatabaseConfig.Builder
Builder class for creating DatabaseConfig instances with fluent configuration API.
|
| Constructor and Description |
|---|
DatabaseConfig(Endpoint endpoint,
JedisClientConfig clientConfig)
Constructs a DatabaseConfig with basic endpoint and client configuration.
|
DatabaseConfig(Endpoint endpoint,
JedisClientConfig clientConfig,
org.apache.commons.pool2.impl.GenericObjectPoolConfig<Connection> connectionPoolConfig)
Constructs a DatabaseConfig with endpoint, client, and connection pool configuration.
|
| Modifier and Type | Method and Description |
|---|---|
static MultiDbConfig.DatabaseConfig.Builder |
builder(Endpoint endpoint,
JedisClientConfig clientConfig)
Creates a new Builder instance for configuring a DatabaseConfig.
|
org.apache.commons.pool2.impl.GenericObjectPoolConfig<Connection> |
getConnectionPoolConfig()
Returns the connection pool configuration for this database.
|
Endpoint |
getEndpoint()
Returns the Redis endpoint (host and port) for this database.
|
MultiDbConfig.StrategySupplier |
getHealthCheckStrategySupplier()
Returns the health check strategy supplier for this database.
|
JedisClientConfig |
getJedisClientConfig()
Returns the Jedis client configuration for this database.
|
float |
getWeight()
Returns the weight value used for database selection priority.
|
public DatabaseConfig(Endpoint endpoint, JedisClientConfig clientConfig)
This constructor creates a database configuration with default settings: weight of 1.0f and
PingStrategy for health checks. Use the MultiDbConfig.DatabaseConfig.Builder for more advanced configuration
options.
endpoint - the Redis endpoint (host and port)clientConfig - the Jedis client configurationjava.lang.IllegalArgumentException - if endpoint or clientConfig is nullpublic DatabaseConfig(Endpoint endpoint, JedisClientConfig clientConfig, org.apache.commons.pool2.impl.GenericObjectPoolConfig<Connection> connectionPoolConfig)
This constructor allows specification of connection pool settings in addition to basic endpoint configuration. Default weight of 1.0f and PingStrategy for health checks are used.
endpoint - the Redis endpoint (host and port)clientConfig - the Jedis client configurationconnectionPoolConfig - the connection pool configurationjava.lang.IllegalArgumentException - if endpoint or clientConfig is nullpublic Endpoint getEndpoint()
public static MultiDbConfig.DatabaseConfig.Builder builder(Endpoint endpoint, JedisClientConfig clientConfig)
endpoint - the Redis endpoint (host and port)clientConfig - the Jedis client configurationjava.lang.IllegalArgumentException - if endpoint or clientConfig is nullpublic JedisClientConfig getJedisClientConfig()
public org.apache.commons.pool2.impl.GenericObjectPoolConfig<Connection> getConnectionPoolConfig()
public float getWeight()
Higher weight values indicate higher priority. During failover, databases are selected in descending order of weight (highest weight first).
public MultiDbConfig.StrategySupplier getHealthCheckStrategySupplier()
The strategy supplier is used to create health check instances that monitor this database's availability. Returns null if health checks are disabled.
MultiDbConfig.StrategySupplier,
HealthCheckStrategyCopyright © 2025. All rights reserved.