View | Details | Raw Unified | Return to bug 62175
Collapse All | Expand All

(-)a/java/org/apache/catalina/session/PersistentManagerBase.java (-12 / +20 lines)
Lines 183-188 public abstract class PersistentManagerBase extends ManagerBase Link Here
183
     */
183
     */
184
    private final Map<String,Object> sessionSwapInLocks = new HashMap<>();
184
    private final Map<String,Object> sessionSwapInLocks = new HashMap<>();
185
185
186
    private final ThreadLocal<Session> sessionToSwapIn = new ThreadLocal<>();
187
186
188
187
    // ------------------------------------------------------------- Properties
189
    // ------------------------------------------------------------- Properties
188
190
Lines 707-724 public abstract class PersistentManagerBase extends ManagerBase Link Here
707
            session = sessions.get(id);
709
            session = sessions.get(id);
708
710
709
            if (session == null) {
711
            if (session == null) {
710
                session = loadSessionFromStore(id);
712
                Session currentSwapInSession = sessionToSwapIn.get();
711
713
                try {
712
                if (session != null && !session.isValid()) {
714
                    if (currentSwapInSession == null || !id.equals(currentSwapInSession.getId())) {
713
                    log.error(sm.getString(
715
                        session = loadSessionFromStore(id);
714
                            "persistentManager.swapInInvalid", id));
716
                        sessionToSwapIn.set(session);
715
                    session.expire();
717
716
                    removeSession(id);
718
                        if (session != null && !session.isValid()) {
717
                    session = null;
719
                            log.error(sm.getString("persistentManager.swapInInvalid", id));
718
                }
720
                            session.expire();
721
                            removeSession(id);
722
                            session = null;
723
                        }
719
724
720
                if (session != null) {
725
                        if (session != null) {
721
                    reactivateLoadedSession(id, session);
726
                            reactivateLoadedSession(id, session);
727
                        }
728
                    }
729
                } finally {
730
                    sessionToSwapIn.remove();
722
                }
731
                }
723
            }
732
            }
724
        }
733
        }
725
- 

Return to bug 62175