private void keepAliveProcessing(Query query, Result result) {
        int maxLifetimeSeconds = query.properties().getInteger(KEEPALIVE_MAXLIFETIMESECONDS, -1);

        if (maxLifetimeSeconds < 0) {
            return;
        } else if (maxLifetimeSeconds == 0) {
            result.getHeaders(true).put(HTTP_CONNECTION_HEADER_NAME, HTTP_CONNECTION_CLOSE_ARGUMENT);
            query.trace(false, 5, simpleName, ": Max HTTP connection lifetime set to 0; adding \"", HTTP_CONNECTION_HEADER_NAME,
                    ": ", HTTP_CONNECTION_CLOSE_ARGUMENT, "\" header");
        } else {
            setCloseIfLifetimeExceeded(query, result, maxLifetimeSeconds);
        }
    }
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