diff --git a/redisson-tomcat/redisson-tomcat-6/src/main/java/org/redisson/tomcat/RedissonSessionManager.java b/redisson-tomcat/redisson-tomcat-6/src/main/java/org/redisson/tomcat/RedissonSessionManager.java index ad9ed047f..e90d93e3a 100644 --- a/redisson-tomcat/redisson-tomcat-6/src/main/java/org/redisson/tomcat/RedissonSessionManager.java +++ b/redisson-tomcat/redisson-tomcat-6/src/main/java/org/redisson/tomcat/RedissonSessionManager.java @@ -176,18 +176,20 @@ public class RedissonSessionManager extends ManagerBase implements Lifecycle { attrs = getMap(id).getAll(RedissonSession.ATTRS); } } catch (Exception e) { - log.error("Can't read session object by id " + id, e); - } - - if (attrs.isEmpty() || !Boolean.valueOf(String.valueOf(attrs.get("session:isValid")))) { - log.info("Session " + id + " can't be found"); - return null; + throw new IOException(e); } RedissonSession session = (RedissonSession) createEmptySession(); + session.load(attrs); session.setId(id); session.setManager(this); - session.load(attrs); + + if (session.isValid()) { + if (session.isNew()) { + session.tellNew(); + } + super.add(session); + } session.access(); session.endAccess(); diff --git a/redisson-tomcat/redisson-tomcat-7/src/main/java/org/redisson/tomcat/RedissonSessionManager.java b/redisson-tomcat/redisson-tomcat-7/src/main/java/org/redisson/tomcat/RedissonSessionManager.java index b55e42a51..1ec7fb814 100644 --- a/redisson-tomcat/redisson-tomcat-7/src/main/java/org/redisson/tomcat/RedissonSessionManager.java +++ b/redisson-tomcat/redisson-tomcat-7/src/main/java/org/redisson/tomcat/RedissonSessionManager.java @@ -154,18 +154,20 @@ public class RedissonSessionManager extends ManagerBase { attrs = getMap(id).getAll(RedissonSession.ATTRS); } } catch (Exception e) { - log.error("Can't read session object by id " + id, e); - } - - if (attrs.isEmpty() || !Boolean.valueOf(String.valueOf(attrs.get("session:isValid")))) { - log.info("Session " + id + " can't be found"); - return null; + throw new IOException(e); } RedissonSession session = (RedissonSession) createEmptySession(); + session.load(attrs); session.setId(id); session.setManager(this); - session.load(attrs); + + if (session.isValid()) { + if (session.isNew()) { + session.tellNew(); + } + super.add(session); + } session.access(); session.endAccess(); diff --git a/redisson-tomcat/redisson-tomcat-8/src/main/java/org/redisson/tomcat/RedissonSessionManager.java b/redisson-tomcat/redisson-tomcat-8/src/main/java/org/redisson/tomcat/RedissonSessionManager.java index ccda2aa49..a4a7b8363 100644 --- a/redisson-tomcat/redisson-tomcat-8/src/main/java/org/redisson/tomcat/RedissonSessionManager.java +++ b/redisson-tomcat/redisson-tomcat-8/src/main/java/org/redisson/tomcat/RedissonSessionManager.java @@ -153,18 +153,20 @@ public class RedissonSessionManager extends ManagerBase { attrs = getMap(id).getAll(RedissonSession.ATTRS); } } catch (Exception e) { - log.error("Can't read session object by id " + id, e); - } - - if (attrs.isEmpty() || !Boolean.valueOf(String.valueOf(attrs.get("session:isValid")))) { - log.info("Session " + id + " can't be found"); - return null; + throw new IOException(e); } RedissonSession session = (RedissonSession) createEmptySession(); + session.load(attrs); session.setId(id); session.setManager(this); - session.load(attrs); + + if (session.isValid()) { + if (session.isNew()) { + session.tellNew(); + } + super.add(session); + } session.access(); session.endAccess(); diff --git a/redisson-tomcat/redisson-tomcat-9/src/main/java/org/redisson/tomcat/RedissonSessionManager.java b/redisson-tomcat/redisson-tomcat-9/src/main/java/org/redisson/tomcat/RedissonSessionManager.java index ccda2aa49..a4a7b8363 100644 --- a/redisson-tomcat/redisson-tomcat-9/src/main/java/org/redisson/tomcat/RedissonSessionManager.java +++ b/redisson-tomcat/redisson-tomcat-9/src/main/java/org/redisson/tomcat/RedissonSessionManager.java @@ -153,18 +153,20 @@ public class RedissonSessionManager extends ManagerBase { attrs = getMap(id).getAll(RedissonSession.ATTRS); } } catch (Exception e) { - log.error("Can't read session object by id " + id, e); - } - - if (attrs.isEmpty() || !Boolean.valueOf(String.valueOf(attrs.get("session:isValid")))) { - log.info("Session " + id + " can't be found"); - return null; + throw new IOException(e); } RedissonSession session = (RedissonSession) createEmptySession(); + session.load(attrs); session.setId(id); session.setManager(this); - session.load(attrs); + + if (session.isValid()) { + if (session.isNew()) { + session.tellNew(); + } + super.add(session); + } session.access(); session.endAccess();