protected void onInvalidation(Session s, InvalidSessionException ise, SessionKey key) {
        if (ise instanceof ExpiredSessionException) {
            onExpiration(s, (ExpiredSessionException) ise, key);
            return;
        }
        LOGGER.trace("Session with id [{}] is invalid.", s.getId());
        try {
            onStop(s);
            notifyStop(s);
        } finally {
            afterStopped(s);
        }
    }
Looks up a session from the underlying data store based on the specified session key.

@param key the session key to use to look up the target session.
@return the session identified by {@code sessionId}.
@throws UnknownSessionException if there is no session identified by {@code sessionId}.
core/src/main/java/org/apache/shiro/session/mgt/AbstractValidatingSessionManager.java