服务重启后,用户登录时加载用户session
This commit is contained in:
@@ -368,10 +368,21 @@ public class MemorySessionStore implements ISessionsStore {
|
||||
}
|
||||
|
||||
Session session = sessions.get(clientID);
|
||||
ClientSession clientSession = new ClientSession(clientID, this);
|
||||
return clientSession;
|
||||
|
||||
return session.getClientSession();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void loadUserSession(String username, String clientID) {
|
||||
if (sessions.containsKey(clientID)) {
|
||||
return;
|
||||
}
|
||||
Session session = databaseStore.getSession(username, clientID, new ClientSession(clientID, this));
|
||||
if (session != null) {
|
||||
sessions.put(clientID, session);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Session> sessionForUser(String username) {
|
||||
ConcurrentSkipListSet<String> sessionSet = userSessions.get(username);
|
||||
|
||||
@@ -57,6 +57,8 @@ public interface ISessionsStore {
|
||||
Session sessionForClientAndUser(String username, String clientID);
|
||||
|
||||
ClientSession sessionForClient(String clientID);
|
||||
|
||||
void loadUserSession(String username, String clientID);
|
||||
|
||||
Collection<Session> sessionForUser(String username);
|
||||
|
||||
|
||||
@@ -343,7 +343,7 @@ public class ProtocolProcessor {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
m_sessionsStore.loadUserSession(username, clientId);
|
||||
ClientSession clientSession = m_sessionsStore.sessionForClient(clientId);
|
||||
boolean isSessionAlreadyStored = clientSession != null;
|
||||
if (isSessionAlreadyStored) {
|
||||
|
||||
Reference in New Issue
Block a user