runtime/runtime_impl_jetty9/src/main/java/com/google/apphosting/runtime/http/JettyHttpApiHostClient.java [176:223]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public void onComplete(Result result) {
      if (result.isFailed()) {
        Throwable failure = result.getFailure();
        if (failure instanceof ApiProxy.ResponseTooLargeException) {
          responseTooBig(callback);
        } else if (failure instanceof TimeoutException) {
          logger.atWarning().withCause(failure).log("HTTP communication timed out");
          timeout(callback);
        } else if (failure instanceof EofException
            && failure.getCause() instanceof ClosedByInterruptException) {
          // This is a very specific combination of exceptions, which we observe is produced with
          // the particular Jetty client we're using. HttpApiProxyImplTest#interruptedApiCall
          // should detect if a future Jetty version produces a different combination.
          logger.atWarning().withCause(failure).log("HTTP communication interrupted");
          cancelled(callback);
        } else if ((failure instanceof ClosedChannelException
                || failure instanceof ClosedSelectorException)
            && config().treatClosedChannelAsCancellation()) {
          logger.atWarning().log("Treating %s as cancellation", failure.getClass().getSimpleName());
          cancelled(callback);
        } else if (failure instanceof RejectedExecutionException) {
          logger.atWarning().withCause(failure).log("API connection appears to be disabled");
          cancelled(callback);
        } else if (failure instanceof HttpResponseException) {
          // TODO(b/111131627) remove this once upgraded to Jetty that includes the cause
          HttpResponseException hre = (HttpResponseException) failure;
          Response response = hre.getResponse();
          String httpError = response.getStatus() + " " + response.getReason();
          logger.atWarning().withCause(failure).log("HTTP communication failed: %s", httpError);
          if (hre.getCause() == null) {
            failure = new Exception(httpError, hre);
          }
          communicationFailure(context, failure + ": " + httpError, callback, failure);
        } else {
          logger.atWarning().withCause(failure).log("HTTP communication failed");
          communicationFailure(context, String.valueOf(failure), callback, failure);
        }
      } else {
        Response response = result.getResponse();
        if (response.getStatus() == HttpURLConnection.HTTP_OK) {
          receivedResponse(buffer, offset, context, callback);
        } else {
          String httpError = response.getStatus() + " " + response.getReason();
          logger.atWarning().log("HTTP communication got error: %s", httpError);
          communicationFailure(context, httpError, callback, null);
        }
      }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



runtime/runtime_impl_jetty12/src/main/java/com/google/apphosting/runtime/http/JettyHttpApiHostClient.java [176:223]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public void onComplete(Result result) {
      if (result.isFailed()) {
        Throwable failure = result.getFailure();
        if (failure instanceof ApiProxy.ResponseTooLargeException) {
          responseTooBig(callback);
        } else if (failure instanceof TimeoutException) {
          logger.atWarning().withCause(failure).log("HTTP communication timed out");
          timeout(callback);
        } else if (failure instanceof EofException
            && failure.getCause() instanceof ClosedByInterruptException) {
          // This is a very specific combination of exceptions, which we observe is produced with
          // the particular Jetty client we're using. HttpApiProxyImplTest#interruptedApiCall
          // should detect if a future Jetty version produces a different combination.
          logger.atWarning().withCause(failure).log("HTTP communication interrupted");
          cancelled(callback);
        } else if ((failure instanceof ClosedChannelException
                || failure instanceof ClosedSelectorException)
            && config().treatClosedChannelAsCancellation()) {
          logger.atWarning().log("Treating %s as cancellation", failure.getClass().getSimpleName());
          cancelled(callback);
        } else if (failure instanceof RejectedExecutionException) {
          logger.atWarning().withCause(failure).log("API connection appears to be disabled");
          cancelled(callback);
        } else if (failure instanceof HttpResponseException) {
          // TODO(b/111131627) remove this once upgraded to Jetty that includes the cause
          HttpResponseException hre = (HttpResponseException) failure;
          Response response = hre.getResponse();
          String httpError = response.getStatus() + " " + response.getReason();
          logger.atWarning().withCause(failure).log("HTTP communication failed: %s", httpError);
          if (hre.getCause() == null) {
            failure = new Exception(httpError, hre);
          }
          communicationFailure(context, failure + ": " + httpError, callback, failure);
        } else {
          logger.atWarning().withCause(failure).log("HTTP communication failed");
          communicationFailure(context, String.valueOf(failure), callback, failure);
        }
      } else {
        Response response = result.getResponse();
        if (response.getStatus() == HttpURLConnection.HTTP_OK) {
          receivedResponse(buffer, offset, context, callback);
        } else {
          String httpError = response.getStatus() + " " + response.getReason();
          logger.atWarning().log("HTTP communication got error: %s", httpError);
          communicationFailure(context, httpError, callback, null);
        }
      }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



