mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-22 20:28:00 +00:00
add log option, check connection for JedisPooled
This commit is contained in:
parent
d77e909e7d
commit
2ae9b5d480
@ -109,6 +109,7 @@ public interface ConfigLoader {
|
|||||||
config.setMaxTotal(node.getNode("compatibility-max-connections").getInt(3));
|
config.setMaxTotal(node.getNode("compatibility-max-connections").getInt(3));
|
||||||
config.setBlockWhenExhausted(true);
|
config.setBlockWhenExhausted(true);
|
||||||
jedisPool = new JedisPool(config, redisServer, redisPort, 0, redisPassword, useSSL);
|
jedisPool = new JedisPool(config, redisServer, redisPort, 0, redisPassword, useSSL);
|
||||||
|
plugin.logInfo("Compatibility JedisPool was created");
|
||||||
}
|
}
|
||||||
GenericObjectPoolConfig<Connection> poolConfig = new GenericObjectPoolConfig<>();
|
GenericObjectPoolConfig<Connection> poolConfig = new GenericObjectPoolConfig<>();
|
||||||
poolConfig.setMaxTotal(maxConnections);
|
poolConfig.setMaxTotal(maxConnections);
|
||||||
|
@ -14,10 +14,16 @@ public class JedisPooledSummoner implements Summoner<JedisPooled> {
|
|||||||
public JedisPooledSummoner(JedisPooled jedisPooled, JedisPool jedisPool) {
|
public JedisPooledSummoner(JedisPooled jedisPooled, JedisPool jedisPool) {
|
||||||
this.jedisPooled = jedisPooled;
|
this.jedisPooled = jedisPooled;
|
||||||
this.jedisPool = jedisPool;
|
this.jedisPool = jedisPool;
|
||||||
try (Jedis jedis = this.jedisPool.getResource()) {
|
// test connections
|
||||||
// Test the connection to make sure configuration is right
|
if (jedisPool != null) {
|
||||||
jedis.ping();
|
try (Jedis jedis = this.jedisPool.getResource()) {
|
||||||
|
// Test the connection to make sure configuration is right
|
||||||
|
jedis.ping();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
jedisPooled.set("random_data", "0");
|
||||||
|
jedisPooled.del("random_data");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user