mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-22 20:28:00 +00:00
block when exhausted, new config options for the compatibility pool max connections
This commit is contained in:
parent
ee76fa0b3d
commit
d77e909e7d
@ -78,6 +78,7 @@ public interface ConfigLoader {
|
|||||||
Set<HostAndPort> hostAndPortSet = new HashSet<>();
|
Set<HostAndPort> hostAndPortSet = new HashSet<>();
|
||||||
GenericObjectPoolConfig<Connection> poolConfig = new GenericObjectPoolConfig<>();
|
GenericObjectPoolConfig<Connection> poolConfig = new GenericObjectPoolConfig<>();
|
||||||
poolConfig.setMaxTotal(maxConnections);
|
poolConfig.setMaxTotal(maxConnections);
|
||||||
|
poolConfig.setBlockWhenExhausted(true);
|
||||||
node.getNode("redis-cluster-servers").getChildrenList().forEach((childNode) -> {
|
node.getNode("redis-cluster-servers").getChildrenList().forEach((childNode) -> {
|
||||||
Map<Object, ? extends ConfigurationNode> hostAndPort = childNode.getChildrenMap();
|
Map<Object, ? extends ConfigurationNode> hostAndPort = childNode.getChildrenMap();
|
||||||
String host = hostAndPort.get("host").getString();
|
String host = hostAndPort.get("host").getString();
|
||||||
@ -105,11 +106,13 @@ public interface ConfigLoader {
|
|||||||
JedisPool jedisPool = null;
|
JedisPool jedisPool = null;
|
||||||
if (node.getNode("enable-jedis-pool-compatibility").getBoolean(true)) {
|
if (node.getNode("enable-jedis-pool-compatibility").getBoolean(true)) {
|
||||||
JedisPoolConfig config = new JedisPoolConfig();
|
JedisPoolConfig config = new JedisPoolConfig();
|
||||||
config.setMaxTotal(maxConnections);
|
config.setMaxTotal(node.getNode("compatibility-max-connections").getInt(3));
|
||||||
|
config.setBlockWhenExhausted(true);
|
||||||
jedisPool = new JedisPool(config, redisServer, redisPort, 0, redisPassword, useSSL);
|
jedisPool = new JedisPool(config, redisServer, redisPort, 0, redisPassword, useSSL);
|
||||||
}
|
}
|
||||||
GenericObjectPoolConfig<Connection> poolConfig = new GenericObjectPoolConfig<>();
|
GenericObjectPoolConfig<Connection> poolConfig = new GenericObjectPoolConfig<>();
|
||||||
poolConfig.setMaxTotal(maxConnections);
|
poolConfig.setMaxTotal(maxConnections);
|
||||||
|
poolConfig.setBlockWhenExhausted(true);
|
||||||
summoner = new JedisPooledSummoner(new JedisPooled(poolConfig, redisServer, redisPort, 0, redisPassword, useSSL), jedisPool);
|
summoner = new JedisPooledSummoner(new JedisPooled(poolConfig, redisServer, redisPort, 0, redisPassword, useSSL), jedisPool);
|
||||||
redisBungeeMode = RedisBungeeMode.SINGLE;
|
redisBungeeMode = RedisBungeeMode.SINGLE;
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,8 @@ proxy-id: "test-1"
|
|||||||
# enabled by default
|
# enabled by default
|
||||||
# ignored when cluster mode is enabled
|
# ignored when cluster mode is enabled
|
||||||
enable-jedis-pool-compatibility: true
|
enable-jedis-pool-compatibility: true
|
||||||
|
# max connections for the compatibility pool
|
||||||
|
compatibility-max-connections: 3
|
||||||
|
|
||||||
# Register redis bungee legacy commands
|
# Register redis bungee legacy commands
|
||||||
# if this disabled override-bungee-commands will be ignored
|
# if this disabled override-bungee-commands will be ignored
|
||||||
|
Loading…
Reference in New Issue
Block a user