@Override
    public final void setSessionTimeout(int seconds) throws IllegalArgumentException {
        if (seconds < 0) {
            throw new IllegalArgumentException("seconds < 0");
        }

        synchronized (sessions) {
            // Set the timeout on this context.
            timeout = seconds;
            // setSessionTimeout(0) is defined to remove the timeout, but passing 0
            // to SSL_CTX_set_timeout in BoringSSL sets it to the default timeout instead.
            // Pass INT_MAX seconds (68 years), since that's equivalent for practical purposes.
            setTimeout(seconds > 0 ? seconds : Integer.MAX_VALUE);

            Iterator<NativeSslSession> i = sessions.values().iterator();
            while (i.hasNext()) {
                NativeSslSession session = i.next();
                // SSLSession's know their context and consult the
                // timeout as part of their validity condition.
                if (!session.isValid()) {
                    // Let the subclass know.
                    onBeforeRemoveSession(session);
                    i.remove();
                }
            }
        }
    }
This is provided for API-compatibility only, not intended for use. No guarantees are
made WRT performance or the validity of the returned session.
common/src/main/java/org/conscrypt/AbstractSessionContext.java