Skip to content

Commit

Permalink
ATS-33
Browse files Browse the repository at this point in the history
  • Loading branch information
madness-inc committed Oct 20, 2022
1 parent 5c35aef commit 2520664
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
8 changes: 0 additions & 8 deletions src/main/java/org/appng/tomcat/session/Session.java
Expand Up @@ -126,11 +126,6 @@ public synchronized SessionData serialize(String alternativeSiteName) throws IOE
}

public static Session load(Manager manager, SessionData sessionData) throws IOException, ClassNotFoundException {
return load(manager, sessionData, true);
}

public static Session load(Manager manager, SessionData sessionData, boolean addToManager)
throws IOException, ClassNotFoundException {
Session session = null;
try (ByteArrayInputStream is = new ByteArrayInputStream(sessionData.getData());
ObjectInputStream ois = Utils.getObjectInputStream(is, sessionData.getSite(), manager.getContext())) {
Expand All @@ -142,9 +137,6 @@ public static Session load(Manager manager, SessionData sessionData, boolean add
session.site = sessionData.getSite();
session.access();
session.setClean();
if (addToManager) {
manager.add(session);
}
}
}
return session;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/appng/tomcat/session/SessionManager.java
Expand Up @@ -118,6 +118,7 @@ public Session findSession(String id) throws IOException {
} else {
try {
session = Session.load(this, sessionData);
this.add(session);
if (log().isDebugEnabled()) {
if (null == session) {
log().debug(String.format("Session %s found, but has expired!", id));
Expand Down
Expand Up @@ -134,6 +134,7 @@ public void processExpires() {
AtomicInteger count = new AtomicInteger(0);
keys.forEach(k -> {
try {
// no lock needed here!
SessionData sessionData = getPersistentSessions().get(k);
if (null == sessionData) {
if (log.isDebugEnabled()) {
Expand All @@ -143,8 +144,7 @@ public void processExpires() {
removeLocal(sessions.get(k));
}
} else {
// do NOT add the session to the manager, since this would override the locally cached session!
Session session = Session.load(this, sessionData, false);
Session session = Session.load(this, sessionData);
if (null == session) {
// session is not valid, so manager.remove(session, true) already has been called
// which in turn will remove the session from the local cache and also from the persistent store
Expand Down

0 comments on commit 2520664

Please sign in to comment.