Check session exists before saving
This commit is contained in:
parent
7501eabd2e
commit
074cf281c9
@ -275,16 +275,21 @@ public class SessionManager {
|
|||||||
*/
|
*/
|
||||||
public synchronized void remove(SessionOwner owner) {
|
public synchronized void remove(SessionOwner owner) {
|
||||||
checkNotNull(owner);
|
checkNotNull(owner);
|
||||||
save(sessions.remove(getKey(owner)));
|
SessionHolder session = sessions.remove(getKey(owner));
|
||||||
|
if (session != null) {
|
||||||
|
save(session);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void forget(SessionOwner owner) {
|
public synchronized void forget(SessionOwner owner) {
|
||||||
checkNotNull(owner);
|
checkNotNull(owner);
|
||||||
UUID key = getKey(owner);
|
UUID key = getKey(owner);
|
||||||
SessionHolder holder = sessions.remove(key);
|
SessionHolder holder = sessions.remove(key);
|
||||||
|
if (holder != null) {
|
||||||
softSessions.put(key, new SoftReference(holder));
|
softSessions.put(key, new SoftReference(holder));
|
||||||
save(holder);
|
save(holder);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all sessions.
|
* Remove all sessions.
|
||||||
|
Loading…
Reference in New Issue
Block a user