when using findSession check if the session exists in Redis first before creating a new one - a fix for #2019

pull/2070/head
Zhelyazko Chobantonov 6 years ago
parent 98c73ccc14
commit 7a92208f0a

@ -181,12 +181,20 @@ public class RedissonSessionManager extends ManagerBase implements Lifecycle {
Session result = super.findSession(id);
if (result == null) {
if (id != null) {
Map<String, Object> attrs = new HashMap<String, Object>();
Map<String, Object> attrs = null;
try {
attrs = getMap(id).getAll(RedissonSession.ATTRS);
RMap map = getMap(id);
if (map.isExists()) {
attrs = map.getAll(RedissonSession.ATTRS);
}
} catch (Exception e) {
log.error("Can't read session object by id: " + id, e);
}
if (attrs == null) {
log.info("Session " + id + " can't be found");
return null;
}
RedissonSession session = (RedissonSession) createEmptySession();
session.load(attrs);

@ -160,12 +160,20 @@ public class RedissonSessionManager extends ManagerBase {
Session result = super.findSession(id);
if (result == null) {
if (id != null) {
Map<String, Object> attrs = new HashMap<String, Object>();
Map<String, Object> attrs = null;
try {
attrs = getMap(id).getAll(RedissonSession.ATTRS);
RMap map = getMap(id);
if (map.isExists()) {
attrs = map.getAll(RedissonSession.ATTRS);
}
} catch (Exception e) {
log.error("Can't read session object by id: " + id, e);
}
if (attrs == null) {
log.info("Session " + id + " can't be found");
return null;
}
RedissonSession session = (RedissonSession) createEmptySession();
session.load(attrs);

@ -159,13 +159,21 @@ public class RedissonSessionManager extends ManagerBase {
Session result = super.findSession(id);
if (result == null) {
if (id != null) {
Map<String, Object> attrs = new HashMap<String, Object>();
Map<String, Object> attrs = null;
try {
attrs = getMap(id).getAll(RedissonSession.ATTRS);
RMap map = getMap(id);
if (map.isExists()) {
attrs = map.getAll(RedissonSession.ATTRS);
}
} catch (Exception e) {
log.error("Can't read session object by id: " + id, e);
}
if (attrs == null) {
log.info("Session " + id + " can't be found");
return null;
}
RedissonSession session = (RedissonSession) createEmptySession();
session.load(attrs);
session.setId(id);

@ -159,12 +159,20 @@ public class RedissonSessionManager extends ManagerBase {
Session result = super.findSession(id);
if (result == null) {
if (id != null) {
Map<String, Object> attrs = new HashMap<String, Object>();
Map<String, Object> attrs = null;
try {
attrs = getMap(id).getAll(RedissonSession.ATTRS);
RMap map = getMap(id);
if (map.isExists()) {
attrs = map.getAll(RedissonSession.ATTRS);
}
} catch (Exception e) {
log.error("Can't read session object by id: " + id, e);
}
if (attrs == null) {
log.info("Session " + id + " can't be found");
return null;
}
RedissonSession session = (RedissonSession) createEmptySession();
session.load(attrs);

Loading…
Cancel
Save