Package org.springframework.data.redis

Examples of org.springframework.data.redis.RedisConnectionFailureException


  public void redisIsDown() throws Exception {
    RedisConnection redisConnection = mock(RedisConnection.class);
    RedisConnectionFactory redisConnectionFactory = mock(RedisConnectionFactory.class);
    given(redisConnectionFactory.getConnection()).willReturn(redisConnection);
    given(redisConnection.info()).willThrow(
        new RedisConnectionFailureException("Connection failed"));
    RedisHealthIndicator healthIndicator = new RedisHealthIndicator(
        redisConnectionFactory);

    Health health = healthIndicator.health();
    assertEquals(Status.DOWN, health.getStatus());
View Full Code Here


      if (dbIndex > 0) {
        connection.select(dbIndex);
      }
      return connection;
    } catch (RedisException e) {
      throw new RedisConnectionFailureException("Unable to connect to Redis on " + getHostName() + ":" + getPort(), e);
    }
  }
View Full Code Here

    if (ex instanceof RedisException) {
      return new RedisSystemException("Redis exception", ex);
    }

    if (ex instanceof ChannelException) {
      return new RedisConnectionFailureException("Redis connection failed", ex);
    }

    if (ex instanceof TimeoutException) {
      return new QueryTimeoutException("Redis command timed out", ex);
    }
View Full Code Here

   * @param ex JRedis exception
   * @return converted exception
   */
  public static DataAccessException convertJredisAccessException(ClientRuntimeException ex) {
    if (ex instanceof NotConnectedException) {
      return new RedisConnectionFailureException(ex.getMessage(), ex);
    }
    return new InvalidDataAccessResourceUsageException(ex.getMessage(), ex);
  }
View Full Code Here

    }
    if (ex instanceof JedisDataException) {
      return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
    }
    if (ex instanceof JedisConnectionException) {
      return new RedisConnectionFailureException(ex.getMessage(), ex);
    }
    if (ex instanceof JedisException) {
      return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
    }
    if (ex instanceof UnknownHostException) {
      return new RedisConnectionFailureException("Unknown host " + ex.getMessage(), ex);
    }
    if (ex instanceof IOException) {
      return new RedisConnectionFailureException("Could not connect to Redis server", ex);
    }

    return null;
  }
View Full Code Here

  public static DataAccessException convertJedisAccessException(JedisException ex) {
    if (ex instanceof JedisDataException) {
      return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
    }
    if (ex instanceof JedisConnectionException) {
      return new RedisConnectionFailureException(ex.getMessage(), ex);
    }

    // fallback to invalid data exception
    return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
  }
View Full Code Here

    return null;
  }

  static DataAccessException convertJedisAccessException(IOException ex) {
    if (ex instanceof UnknownHostException) {
      return new RedisConnectionFailureException("Unknown host " + ex.getMessage(), ex);
    }
    return new RedisConnectionFailureException("Could not connect to Redis server", ex);
  }
View Full Code Here

    }
    return new RedisConnectionFailureException("Could not connect to Redis server", ex);
  }

  static DataAccessException convertJedisAccessException(TimeoutException ex) {
    throw new RedisConnectionFailureException("Jedis pool timed out. Could not get Redis Connection", ex);
  }
View Full Code Here

      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);
    }
  }
View Full Code Here

  public SrpConnection(String host, int port, BlockingQueue<SrpConnection> queue) {
    try {
      this.client = new RedisClient(host, port);
      this.queue = queue;
    } catch (IOException e) {
      throw new RedisConnectionFailureException("Could not connect", e);
    } catch (RedisException e) {
      throw new RedisConnectionFailureException("Could not connect", e);
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.redis.RedisConnectionFailureException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.