Merge pull request #5915 from bclay2116/master

Fix #5426
pull/5977/head
Nikita Koksharov 8 months ago committed by GitHub
commit 0824ac8e5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -392,6 +392,32 @@ public class RedissonSession extends StandardSession {
}
}
@Override
public void setId(String id, boolean notify) {
if ((this.id != null) && (manager != null)) {
redissonManager.superRemove(this);
if (map == null) {
map = redissonManager.getMap(this.id);
}
map.rename(redissonManager.getTomcatSessionKeyName(id));
}
boolean idWasNull = this.id == null;
this.id = id;
if (manager != null) {
if (idWasNull) {
redissonManager.add(this);
} else {
redissonManager.superAdd(this);
}
}
if (notify) {
tellNew();
}
}
public void save() {
if (map == null) {
map = redissonManager.getMap(id);

@ -144,9 +144,13 @@ public class RedissonSessionManager extends ManagerBase {
return redisson.getSet(name, StringCodec.INSTANCE);
}
public RMap<String, Object> getMap(String sessionId) {
public String getTomcatSessionKeyName(String sessionId) {
String separator = keyPrefix == null || keyPrefix.isEmpty() ? "" : ":";
String name = keyPrefix + separator + "redisson:tomcat_session:" + sessionId;
return keyPrefix + separator + "redisson:tomcat_session:" + sessionId;
}
public RMap<String, Object> getMap(String sessionId) {
String name = getTomcatSessionKeyName(sessionId);
return redisson.getMap(name, new CompositeCodec(StringCodec.INSTANCE, codecToUse, codecToUse));
}
@ -212,6 +216,10 @@ public class RedissonSessionManager extends ManagerBase {
return session;
}
public void superRemove(Session session) {
super.remove(session, false);
}
@Override
public void remove(Session session, boolean update) {
super.remove(session, update);
@ -221,6 +229,10 @@ public class RedissonSessionManager extends ManagerBase {
}
}
public void superAdd(Session session) {
super.add(session);
}
@Override
public void add(Session session) {
super.add(session);

@ -410,6 +410,32 @@ public class RedissonSession extends StandardSession {
}
}
@Override
public void setId(String id, boolean notify) {
if ((this.id != null) && (manager != null)) {
redissonManager.superRemove(this);
if (map == null) {
map = redissonManager.getMap(this.id);
}
map.rename(redissonManager.getTomcatSessionKeyName(id));
}
boolean idWasNull = this.id == null;
this.id = id;
if (manager != null) {
if (idWasNull) {
redissonManager.add(this);
} else {
redissonManager.superAdd(this);
}
}
if (notify) {
tellNew();
}
}
public void save() {
if (map == null) {
map = redissonManager.getMap(id);

@ -143,10 +143,14 @@ public class RedissonSessionManager extends ManagerBase {
String name = keyPrefix + separator + "redisson:tomcat_notified_nodes:" + sessionId;
return redisson.getSet(name, StringCodec.INSTANCE);
}
public RMap<String, Object> getMap(String sessionId) {
public String getTomcatSessionKeyName(String sessionId) {
String separator = keyPrefix == null || keyPrefix.isEmpty() ? "" : ":";
String name = keyPrefix + separator + "redisson:tomcat_session:" + sessionId;
return keyPrefix + separator + "redisson:tomcat_session:" + sessionId;
}
public RMap<String, Object> getMap(String sessionId) {
String name = getTomcatSessionKeyName(sessionId);
return redisson.getMap(name, new CompositeCodec(StringCodec.INSTANCE, codecToUse, codecToUse));
}
@ -212,6 +216,10 @@ public class RedissonSessionManager extends ManagerBase {
return session;
}
public void superRemove(Session session) {
super.remove(session, false);
}
@Override
public void remove(Session session, boolean update) {
super.remove(session, update);
@ -221,6 +229,10 @@ public class RedissonSessionManager extends ManagerBase {
}
}
public void superAdd(Session session) {
super.add(session);
}
@Override
public void add(Session session) {
super.add(session);

@ -387,6 +387,32 @@ public class RedissonSession extends StandardSession {
}
}
@Override
public void setId(String id, boolean notify) {
if ((this.id != null) && (manager != null)) {
redissonManager.superRemove(this);
if (map == null) {
map = redissonManager.getMap(this.id);
}
map.rename(redissonManager.getTomcatSessionKeyName(id));
}
boolean idWasNull = this.id == null;
this.id = id;
if (manager != null) {
if (idWasNull) {
redissonManager.add(this);
} else {
redissonManager.superAdd(this);
}
}
if (notify) {
tellNew();
}
}
public void save() {
if (map == null) {
map = redissonManager.getMap(id);

@ -144,9 +144,13 @@ public class RedissonSessionManager extends ManagerBase {
return redisson.getSet(name, StringCodec.INSTANCE);
}
public RMap<String, Object> getMap(String sessionId) {
public String getTomcatSessionKeyName(String sessionId) {
String separator = keyPrefix == null || keyPrefix.isEmpty() ? "" : ":";
String name = keyPrefix + separator + "redisson:tomcat_session:" + sessionId;
return keyPrefix + separator + "redisson:tomcat_session:" + sessionId;
}
public RMap<String, Object> getMap(String sessionId) {
String name = getTomcatSessionKeyName(sessionId);
return redisson.getMap(name, new CompositeCodec(StringCodec.INSTANCE, codecToUse, codecToUse));
}
@ -212,6 +216,10 @@ public class RedissonSessionManager extends ManagerBase {
return session;
}
public void superRemove(Session session) {
super.remove(session, false);
}
@Override
public void remove(Session session, boolean update) {
super.remove(session, update);
@ -221,6 +229,10 @@ public class RedissonSessionManager extends ManagerBase {
}
}
public void superAdd(Session session) {
super.add(session);
}
@Override
public void add(Session session) {
super.add(session);

@ -387,6 +387,32 @@ public class RedissonSession extends StandardSession {
}
}
@Override
public void setId(String id, boolean notify) {
if ((this.id != null) && (manager != null)) {
redissonManager.superRemove(this);
if (map == null) {
map = redissonManager.getMap(this.id);
}
map.rename(redissonManager.getTomcatSessionKeyName(id));
}
boolean idWasNull = this.id == null;
this.id = id;
if (manager != null) {
if (idWasNull) {
redissonManager.add(this);
} else {
redissonManager.superAdd(this);
}
}
if (notify) {
tellNew();
}
}
public void save() {
if (map == null) {
map = redissonManager.getMap(id);

@ -144,9 +144,13 @@ public class RedissonSessionManager extends ManagerBase {
return redisson.getSet(name, StringCodec.INSTANCE);
}
public RMap<String, Object> getMap(String sessionId) {
public String getTomcatSessionKeyName(String sessionId) {
String separator = keyPrefix == null || keyPrefix.isEmpty() ? "" : ":";
String name = keyPrefix + separator + "redisson:tomcat_session:" + sessionId;
return keyPrefix + separator + "redisson:tomcat_session:" + sessionId;
}
public RMap<String, Object> getMap(String sessionId) {
String name = getTomcatSessionKeyName(sessionId);
return redisson.getMap(name, new CompositeCodec(StringCodec.INSTANCE, codecToUse, codecToUse));
}
@ -212,6 +216,10 @@ public class RedissonSessionManager extends ManagerBase {
return session;
}
public void superRemove(Session session) {
super.remove(session, false);
}
@Override
public void remove(Session session, boolean update) {
super.remove(session, update);
@ -221,6 +229,10 @@ public class RedissonSessionManager extends ManagerBase {
}
}
public void superAdd(Session session) {
super.add(session);
}
@Override
public void add(Session session) {
super.add(session);

Loading…
Cancel
Save