boolean hasValidSession(int brokerId) {
        BrokerHeartbeatState broker = brokers.get(brokerId);
        if (broker == null) return false;
        return hasValidSession(broker);
    }
Check if the given broker has a valid session.

@param brokerId      The broker ID to check.

@return              True if the given broker has a valid session.
metadata/src/main/java/org/apache/kafka/controller/BrokerHeartbeatManager.java