/** * If a response from a node includes a non-zero throttle delay and client-side throttling has been enabled for * the connection to the node, throttle the connection for the specified delay. * * @param response the response * @param apiVersion the API version of the response * @param nodeId the id of the node * @param now The current time */ private void maybeThrottle(AbstractResponse response, short apiVersion, String nodeId, long now) { int throttleTimeMs = response.throttleTimeMs(); if (throttleTimeMs > 0 && response.shouldClientThrottle(apiVersion)) { connectionStates.throttle(nodeId, now + throttleTimeMs); log.trace("Connection to node {} is throttled for {} ms until timestamp {}", nodeId, throttleTimeMs, now + throttleTimeMs); } }