/** * Constructs a new <code>JedisConnection</code> instance backed by a jedis pool. * * @param jedis * @param pool can be null, if no pool is used * @param dbIndex * @param clientName the client name, can be {@literal null}. * @since 1.8 */ protected JedisConnection(Jedis jedis, @Nullable Pool<Jedis> pool, int dbIndex, String clientName) { this.jedis = jedis; this.pool = pool; this.dbIndex = dbIndex; this.clientName = clientName; // select the db // if this fail, do manual clean-up before propagating the exception // as we're inside the constructor if (dbIndex != jedis.getDB()) { try { select(dbIndex); } catch (DataAccessException ex) { close(); throw ex; } } }
/** * Constructs a new <code>JedisConnection</code> instance backed by a jedis pool. * * @param jedis * @param pool can be null, if no pool is used * @param dbIndex * @param clientName the client name, can be {@literal null}. * @since 1.8 */ protected JedisConnection(Jedis jedis, @Nullable Pool<Jedis> pool, int dbIndex, String clientName) { this.jedis = jedis; this.pool = pool; this.dbIndex = dbIndex; this.clientName = clientName; // select the db // if this fail, do manual clean-up before propagating the exception // as we're inside the constructor if (dbIndex != jedis.getDB()) { try { select(dbIndex); } catch (DataAccessException ex) { close(); throw ex; } } }
/** * Constructs a new <code>JedisConnection</code> instance backed by a jedis pool. * * @param jedis * @param pool can be null, if no pool is used * @param dbIndex * @param clientName the client name, can be {@literal null}. * @since 1.8 */ protected JedisConnection(Jedis jedis, @Nullable Pool<Jedis> pool, int dbIndex, String clientName) { this.jedis = jedis; this.pool = pool; this.dbIndex = dbIndex; this.clientName = clientName; // select the db // if this fail, do manual clean-up before propagating the exception // as we're inside the constructor if (dbIndex != jedis.getDB()) { try { select(dbIndex); } catch (DataAccessException ex) { close(); throw ex; } } }