List of usage examples for org.springframework.data.redis RedisConnectionFailureException RedisConnectionFailureException
public RedisConnectionFailureException(String msg, Throwable cause)
From source file:org.solq.dht.db.redis.service.JedisConnectionFactory.java
/** * Returns a Jedis instance to be used as a Redis connection. The instance * can be newly created or retrieved from a pool. * // w ww. ja v a2 s.c o m * @return Jedis instance ready for wrapping into a {@link RedisConnection}. */ protected Jedis fetchJedisConnector() { try { if (usePool && pool != null) { return pool.getResource(); } Jedis jedis = new Jedis(getShardInfo()); // force initialization (see Jedis issue #82) jedis.connect(); return jedis; } catch (Exception ex) { throw new RedisConnectionFailureException("Cannot get Jedis connection", ex); } }
From source file:org.springframework.data.redis.connection.jedis.JedisConnectionFactory.java
/** * Returns a Jedis instance to be used as a Redis connection. The instance can be newly created or retrieved from a * pool./* ww w .j a v a2 s . c o m*/ * * @return Jedis instance ready for wrapping into a {@link RedisConnection}. */ protected Jedis fetchJedisConnector() { try { if (usePool && pool != null) { return pool.getResource(); } Jedis jedis = new Jedis(getShardInfo()); // force initialization (see Jedis issue #82) jedis.connect(); return jedis; } catch (Exception ex) { throw new RedisConnectionFailureException("Cannot get Jedis connection", ex); } }
From source file:org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.java
protected RedisAsyncConnection<byte[], byte[]> createLettuceConnector() { try {//from w w w . jav a2s .c om RedisAsyncConnection connection = null; if (client instanceof RedisClient) { connection = ((RedisClient) client).connectAsync(LettuceConnection.CODEC); if (dbIndex > 0) { connection.select(dbIndex); } } else { connection = (RedisAsyncConnection<byte[], byte[]>) ((RedisClusterClient) client) .connectClusterAsync(LettuceConnection.CODEC); } return connection; } catch (RedisException e) { throw new RedisConnectionFailureException( "Unable to connect to Redis on " + getHostName() + ":" + getPort(), e); } }