final NativeSslSession getSessionFromCache(byte[] sessionId) {
        if (sessionId == null) {
            return null;
        }

        // First, look in the in-memory cache.
        NativeSslSession session;
        synchronized (sessions) {
            session = sessions.get(new ByteArray(sessionId));
        }
        if (session != null && session.isValid()) {
            if (session.isSingleUse()) {
                removeSession(session);
            }
            return session;
        }

        // Look in persistent cache.  We don't currently delete sessions from the persistent
        // cache, so we may find a multi-use (aka TLS 1.2) session after having received and
        // then used up one or more single-use (aka TLS 1.3) sessions.
        return getSessionFromPersistentCache(sessionId);
    }
Called for server sessions only. Retrieves the session by its ID. Overridden by
{@link ServerSessionContext} to
common/src/main/java/org/conscrypt/AbstractSessionContext.java