本文整理匯總了Java中redis.clients.jedis.exceptions.JedisException.getMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java JedisException.getMessage方法的具體用法?Java JedisException.getMessage怎麽用?Java JedisException.getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類redis.clients.jedis.exceptions.JedisException
的用法示例。
在下文中一共展示了JedisException.getMessage方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleJedisException
import redis.clients.jedis.exceptions.JedisException; //導入方法依賴的package包/類
/**
* Handle jedisException, write log and return whether the connection is broken.
*/
protected boolean handleJedisException(JedisException jedisException) {
if (jedisException instanceof JedisConnectionException) {
logger.error("Redis connection " + jedisPool.getAddress() + " lost.", jedisException);
} else if (jedisException instanceof JedisDataException) {
if ((jedisException.getMessage() != null) && (jedisException.getMessage().indexOf("READONLY") != -1)) {
logger.error("Redis connection " + jedisPool.getAddress() + " are read-only slave.", jedisException);
} else {
// dataException, isBroken=false
return false;
}
} else {
logger.error("Jedis exception happen.", jedisException);
}
return true;
}
示例2: publish
import redis.clients.jedis.exceptions.JedisException; //導入方法依賴的package包/類
@Override
public void publish(Queue queue, byte[] message) throws QueueException {
validateQueue(queue);
try (Jedis jedis = pool.getResource()) {
jedis.publish(queue.value(), toStringCodex.encode(message));
} catch(JedisException e) {
throw new QueueException(e.getMessage(), e);
}
}
示例3: convertJedisAccessException
import redis.clients.jedis.exceptions.JedisException; //導入方法依賴的package包/類
public static DataAccessException convertJedisAccessException(JedisException ex, String host) {
if (ex instanceof JedisDataException) {
return new InvalidDataAccessApiUsageException(ex.getMessage() + " host:" + host, ex);
}
if (ex instanceof JedisConnectionException) {
return new RedisConnectionFailureException(ex.getMessage() + " host:" + host, ex);
}
// fallback to invalid data exception
return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
}
示例4: handleJedisException
import redis.clients.jedis.exceptions.JedisException; //導入方法依賴的package包/類
private boolean handleJedisException(JedisException jedisException) {
if (jedisException instanceof JedisConnectionException) {
log.error("Redis connection lost.", jedisException);
} else if (jedisException instanceof JedisDataException) {
if ((jedisException.getMessage() != null) && (jedisException.getMessage().indexOf("READONLY") != -1)) {
log.error("Redis connection are read-only slave.", jedisException);
} else {
// dataException, isBroken=false
return false;
}
} else {
log.error("Jedis exception happen.", jedisException);
}
return true;
}