Example usage for org.springframework.data.redis RedisSystemException RedisSystemException

List of usage examples for org.springframework.data.redis RedisSystemException RedisSystemException

Introduction

In this page you can find the example usage for org.springframework.data.redis RedisSystemException RedisSystemException.

Prototype

public RedisSystemException(String msg, Throwable cause) 

Source Link

Usage

From source file:com.wyp.module.cache.LicenseCacheDao.java

@Override
public int insert(License entity) {
    redisTemplate.boundValueOps("123").set("TEST_XXX");
    redisTemplate.boundValueOps("age").set("11");
    // ?/*from www  .j  a va  2  s  .  c  o  m*/
    for (int i = 0; i < 5; i++) {
        if (i == 3) {
            throw new RedisSystemException("dsd", new Exception("myself exception....."));
        }
    }
    return 0;
}

From source file:org.springframework.analytics.retry.RedisRetryTemplate.java

@Override
@SuppressWarnings("unchecked")
public <T> T execute(final RedisCallback<T> action, final boolean exposeConnection, final boolean pipeline) {
    if (this.retryOperations != null) {
        try {/*from   www  . j  av a  2 s  .  c om*/
            return this.retryOperations.execute(new RetryCallback<T, Exception>() {

                @Override
                public T doWithRetry(RetryContext context) throws Exception {
                    if (context.getRetryCount() > 0) {
                        logger.warn("Retry of Redis Operation. Retry Count = " + context.getRetryCount());
                    }
                    return RedisRetryTemplate.super.execute(action, exposeConnection, pipeline);
                }

            }, (RecoveryCallback<T>) this.recoveryCallback);
        } catch (Exception e) {
            if (e instanceof RuntimeException) {
                throw (RuntimeException) e;
            }
            throw new RedisSystemException("Unknown checked exception translated", e);
        }
    } else {
        return super.execute(action, exposeConnection, pipeline);
    }
}

From source file:org.springframework.data.redis.connection.jedis.JedisClusterConnection.java

protected DataAccessException convertJedisAccessException(Exception ex) {

    DataAccessException translated = EXCEPTION_TRANSLATION.translate(ex);

    return translated != null ? translated : new RedisSystemException(ex.getMessage(), ex);
}