解决session在重启后,内存中不存在的问题
This commit is contained in:
@@ -282,7 +282,7 @@ public class MemorySessionStore implements ISessionsStore {
|
||||
|
||||
|
||||
@Override
|
||||
public ErrorCode createNewSession(String username, String clientID, boolean cleanSession) {
|
||||
public ErrorCode createNewSession(String username, String clientID, boolean cleanSession, boolean createWhenNoExist) {
|
||||
LOG.debug("createNewSession for client <{}>", clientID);
|
||||
|
||||
Session session = sessions.get(clientID);
|
||||
@@ -296,6 +296,10 @@ public class MemorySessionStore implements ISessionsStore {
|
||||
session = databaseStore.getSession(username, clientID, clientSession);
|
||||
|
||||
if (session == null) {
|
||||
if (!createWhenNoExist) {
|
||||
return ErrorCode.ERROR_CODE_NOT_EXIST;
|
||||
}
|
||||
|
||||
session = databaseStore.createSession(username, clientID, clientSession);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user