Commit a43c265b authored by Mingyang Zhu's avatar Mingyang Zhu
Browse files

catch RedisException

parent 389faaaf
......@@ -14,8 +14,7 @@
package org.opengroup.osdu.search.provider.azure.cache.impl;
import javax.annotation.Resource;
import com.lambdaworks.redis.RedisException;
import org.opengroup.osdu.core.common.cache.ICache;
import org.opengroup.osdu.core.common.logging.JaxRsDpsLog;
import org.opengroup.osdu.core.common.model.search.CursorSettings;
......@@ -23,7 +22,7 @@ import org.opengroup.osdu.search.cache.CursorCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Optional;
import javax.annotation.Resource;
@Component
public class CursorCacheImpl implements CursorCache {
......@@ -44,8 +43,8 @@ public class CursorCacheImpl implements CursorCache {
CursorSettings cursorSettings = null;
try {
cursorSettings = this.cache.get(s);
} catch (Exception ex) {
this.log.error(String.format("Error getting key %s from redis: %s", s, ex));
} catch (RedisException ex) {
this.log.error(String.format("Error getting key %s from redis: %s", s, ex.getMessage()));
}
return cursorSettings;
}
......
......@@ -14,6 +14,7 @@
package org.opengroup.osdu.search.provider.azure.cache.impl;
import com.lambdaworks.redis.RedisException;
import org.opengroup.osdu.azure.cache.ElasticCredentialsCache;
import org.opengroup.osdu.core.common.cache.ICache;
import org.opengroup.osdu.core.common.logging.JaxRsDpsLog;
......@@ -44,8 +45,8 @@ public class ElasticCredentialsCacheImpl extends ElasticCredentialsCache {
ClusterSettings cursorSettings = null;
try {
cursorSettings = this.cache.get(s);
} catch (Exception ex) {
this.log.error(String.format("Error getting key %s from redis: %s", s, ex));
} catch (RedisException ex) {
this.log.error(String.format("Error getting key %s from redis: %s", s, ex.getMessage()));
}
return cursorSettings;
}
......
......@@ -14,6 +14,7 @@
package org.opengroup.osdu.search.service;
import com.lambdaworks.redis.RedisException;
import org.apache.http.HttpStatus;
import org.opengroup.osdu.core.common.cache.ICache;
import org.opengroup.osdu.core.common.entitlements.IEntitlementsFactory;
......@@ -139,8 +140,8 @@ public class EntitlementsAndCacheServiceImpl implements IEntitlementsExtensionSe
Groups groups = null;
try {
groups = this.cache.get(cacheKey);
} catch (Exception ex) {
this.logger.error(String.format("Error getting key %s from redis: %s", cacheKey, ex));
} catch (RedisException ex) {
this.logger.error(String.format("Error getting key %s from redis: %s", cacheKey, ex.getMessage()));
}
if (groups == null) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment