private Session lookupRequiredSession(SessionKey key) throws SessionException {
        Session session = lookupSession(key);
        if (session == null) {
            String msg = "Unable to locate required Session instance based on SessionKey [" + key + "].";
            throw new UnknownSessionException(msg);
        }
        return session;
    }
Template method that allows subclasses to react to a new session being created.
<p/>
This method is invoked <em>before</em> any session listeners are notified.

@param session the session that was just {@link #createSession created}.
@param context the {@link SessionContext SessionContext} that was used to start the session.
core/src/main/java/org/apache/shiro/session/mgt/AbstractNativeSessionManager.java