Given a broken Jedis client connection, if you try to close() it and its connection pool replacement can't connect to the server, a JedisException propagates out from the close() method. This seems both undesirable and unexpected - as a user I just want to close and release any resources allocated to the connection, I should not have to deal with problems caused by other side effects like repopulating the connection pool.
redis.clients.jedis.exceptions.JedisException: Could not return the broken resource to the pool
at redis.clients.jedis.util.Pool.returnBrokenResource(Pool.java:64)
at redis.clients.jedis.Jedis.close(Jedis.java:365)
at ...
Caused by: redis.clients.jedis.exceptions.JedisConnectionException: Failed to connect to 172.20.1.10:6379.
at redis.clients.jedis.DefaultJedisSocketFactory.connectToFirstSuccessfulHost(DefaultJedisSocketFactory.java:68)
at redis.clients.jedis.DefaultJedisSocketFactory.createSocket(DefaultJedisSocketFactory.java:94)
at com.opencloud.resource.memdb.storage.redis.jedis.MetricsJedisSocketFactory.createSocket(0.0.1-SNAPSHOT:35)
at redis.clients.jedis.Connection.connect(Connection.java:269)
at redis.clients.jedis.Connection.initializeFromClientConfig(Connection.java:507)
at redis.clients.jedis.Connection.<init>(Connection.java:109)
at redis.clients.jedis.Jedis.<init>(Jedis.java:290)
at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:180)
at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:555)
at org.apache.commons.pool2.impl.GenericObjectPool.addObject(GenericObjectPool.java:219)
at org.apache.commons.pool2.impl.GenericObjectPool.invalidateObject(GenericObjectPool.java:939)
at org.apache.commons.pool2.impl.GenericObjectPool.invalidateObject(GenericObjectPool.java:909)
at redis.clients.jedis.util.Pool.returnBrokenResource(Pool.java:62)
... 8 more
Suppressed: java.net.SocketTimeoutException: connect timed out
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.base/java.net.Socket.connect(Socket.java:609)
at redis.clients.jedis.DefaultJedisSocketFactory.connectToFirstSuccessfulHost(DefaultJedisSocketFactory.java:80)
... 20 more
Given a broken Jedis client connection, if you try to
close()it and its connection pool replacement can't connect to the server, aJedisExceptionpropagates out from theclose()method. This seems both undesirable and unexpected - as a user I just want to close and release any resources allocated to the connection, I should not have to deal with problems caused by other side effects like repopulating the connection pool.