private void onFailure(RequestMetricReporter metricReporter, JettyResponseWriter responseWriter,
                           Request jettyRequest, Callback callback, Throwable error, boolean developerMode,
                           ResourceReference requestRef) {
        releaseReference(requestRef);

        // tryWriteErrorResponse is responsible for invoking the callback
        responseWriter.tryWriteErrorResponse(unwrapException(error), callback, developerMode);

        HttpServerConformanceTestHooks.markAsProcessed(unwrapException(error));

        var uriPath = jettyRequest.getHttpURI().getPath();
        if (isErrorOfType(error, EofException.class, IOException.class)) {
            log.log(Level.FINE,
                    error,
                    () -> "Network connection was unexpectedly terminated: " + uriPath);
            metricReporter.prematurelyClosed();
            jettyRequest.setAttribute(ACCESS_LOG_STATUS_CODE_OVERRIDE, 499);
        } else if (isErrorOfType(error, TimeoutException.class)) {
            log.log(Level.FINE,
                    error,
                    () -> "Request/stream was timed out by Jetty: " + uriPath);
            jettyRequest.setAttribute(ACCESS_LOG_STATUS_CODE_OVERRIDE, 408);
        } else if (!isErrorOfType(error,
                OverloadException.class, BindingNotFoundException.class, BindingSetNotFoundException.class,
                RequestException.class)) {
            log.log(Level.WARNING, "Request failed: " + uriPath, error);
        }
        metricReporter.failedResponse();
    }
Implementation of a Jetty {@link Handler} that dispatches requests to JDisc's {@link com.yahoo.jdisc.handler.RequestHandler}.

@author bjorncs
container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JdiscDispatchingHandler.java