I am using the Redis in Java using the Jedis client. I am creating a JedisPool and would like to know if the connection is successful, is there a way of doing this without fetching an object?
You can attempt to get the Jedis
resource from the JedisPool
. A JedisConnectionException
will be thrown if a connection has not been established:
JedisPool pool = new JedisPool(...);
try {
Jedis jedis = pool.getResource();
// Is connected
} catch (JedisConnectionException e) {
// Not connected
}