Package org.springframework.data.redis

Examples of org.springframework.data.redis.RedisSystemException


  static final RedisCodec<byte[], byte[]> CODEC = new BytesRedisCodec();

  static DataAccessException convertRedisAccessException(RuntimeException ex) {
    if (ex instanceof RedisCommandInterruptedException) {
      return new RedisSystemException("Redis command interrupted", ex);
    }
    if (ex instanceof RedisException) {
      return new RedisSystemException("Redis exception", ex);
    }
    return null;
  }
View Full Code Here


    Properties info = new Properties();
    StringReader stringReader = new StringReader(reply);
    try {
      info.load(stringReader);
    } catch (Exception ex) {
      throw new RedisSystemException("Cannot read Redis info", ex);
    } finally {
      stringReader.close();
    }
    return info;
  }
View Full Code Here

    if (ex instanceof DataAccessException) {
      return (DataAccessException) ex;
    }

    if (ex instanceof RedisCommandInterruptedException) {
      return new RedisSystemException("Redis command interrupted", ex);
    }

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

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

   */
  @Test
  public void excuteShouldUseEvalInCaseNoSha1PresentForGivenScript() {

    when(redisConnectionMock.evalSha(anyString(), any(ReturnType.class), anyInt())).thenThrow(
        new RedisSystemException("NOSCRIPT No matching script. Please use EVAL.", new Exception()));

    executor.execute(SCRIPT, null);

    verify(redisConnectionMock, times(1)).eval(any(byte[].class), any(ReturnType.class), anyInt());
  }
View Full Code Here

   */
  @Test(expected = RedisSystemException.class)
  public void excuteShouldThrowExceptionInCaseEvalShaFailsWithAlthoughTheScriptExists() {

    when(redisConnectionMock.evalSha(anyString(), any(ReturnType.class), anyInt())).thenThrow(
        new RedisSystemException("Found Script but could not execute it.", new Exception()));

    executor.execute(SCRIPT, null);
  }
View Full Code Here

    try {
      result = connection.evalSha(script.getSha1(), returnType, numKeys, keysAndArgs);
    } catch (Exception e) {

      if (!expectionContainsNoScriptError(e)) {
        throw e instanceof RuntimeException ? (RuntimeException) e : new RedisSystemException(e.getMessage(), e);
      }

      result = connection.eval(scriptBytes(script), returnType, numKeys, keysAndArgs);
    }
   
View Full Code Here

  private static final byte[] ALPHA = "ALPHA".getBytes(Charsets.UTF_8);
  private static final byte[] STORE = "STORE".getBytes(Charsets.UTF_8);

  static DataAccessException convertSRedisAccessException(RuntimeException ex) {
    if (ex instanceof RedisException) {
      return new RedisSystemException("redis exception", ex);
    }
    return null;
  }
View Full Code Here

    // use the same charset as the library
    StringReader stringReader = new StringReader(new String(reply.data(), Charsets.UTF_8));
    try {
      info.load(stringReader);
    } catch (Exception ex) {
      throw new RedisSystemException("Cannot read Redis info", ex);
    } finally {
      stringReader.close();
    }
    return info;
  }
View Full Code Here

        RedisSentinelConnection connection = connectionCache.remove(node);
        if (connection.isOpen()) {
          try {
            connection.close();
          } catch (IOException e) {
            throw new RedisSystemException("Failed to close sentinel connection", e);
          }
        }
      }
    }
  }
View Full Code Here

        broken = true;
      }
      return JredisUtils.convertJredisAccessException((ClientRuntimeException) ex);
    }

    return new RedisSystemException("Unknown JRedis exception", ex);
  }
View Full Code Here

TOP

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

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.