public static RouterRequestExpiryReason isRequestExpired(RequestInfo requestInfo, long currentTimeInMs) {
    if ((requestInfo.isRequestReceivedByNetworkLayer()
        && currentTimeInMs - requestInfo.getRequestEnqueueTime() > requestInfo.getNetworkTimeOutMs())) {
      return RouterRequestExpiryReason.ROUTER_SERVER_NETWORK_CLIENT_TIMEOUT;
    } else if (currentTimeInMs - requestInfo.getRequestCreateTime() > requestInfo.getFinalTimeOutMs()) {
      return RouterRequestExpiryReason.ROUTER_REQUEST_TIMEOUT;
    }
    return RouterRequestExpiryReason.NO_TIMEOUT;
  }
Checks if the request has expired due to either no response from server or it being stuck in router itself
(unavailable quota, etc.) for a long time.
@param requestInfo of the request.
@param currentTimeInMs current time in msec.
@return RouterRequestExpiryReason representing the reason for request expiry.
ambry-router/src/main/java/com/github/ambry/router/RouterUtils.java