private void setCloseIfLifetimeExceeded(Query query, Result result, int maxLifetimeSeconds) {
        if (query.getHttpRequest() == null) {
            query.trace(false, 5, simpleName, " got max lifetime = ", maxLifetimeSeconds,
                    ", but got no JDisc request. Setting no header.");
            return;
        }

        final long connectedAtMillis = query.getHttpRequest().getConnectedAt(TimeUnit.MILLISECONDS);
        final long maxLifeTimeMillis = maxLifetimeSeconds * 1000L;
        if (connectedAtMillis + maxLifeTimeMillis < clock.getAsLong()) {
            result.getHeaders(true).put(HTTP_CONNECTION_HEADER_NAME, HTTP_CONNECTION_CLOSE_ARGUMENT);
            query.trace(false, 5, simpleName, ": Max HTTP connection lifetime (", maxLifetimeSeconds, ") exceeded; adding \"",
                    HTTP_CONNECTION_HEADER_NAME, ": ", HTTP_CONNECTION_CLOSE_ARGUMENT, "\" header");
        }
    }
If the HTTP connection has been alive for too long, set the header
"Connection: Close" to tell the client to close the connection after this
request.
container-search/src/main/java/com/yahoo/search/searchers/ConnectionControlSearcher.java