class DefaultHttpRequestProcessor extends ReportDecider {

    @Override
    public boolean sendPostRequest(final HttpPost httpPost, Map<String, String> metadata)
                                                                                         throws IOException {
        if (metadata != null && PRIORITY.LOW.name().equalsIgnoreCase(metadata.get(PRIORITY_NAME))
            && clearIdleConnectionsTask != null) {
            clearIdleConnectionsTask.run();
        }
        addCommonHeaders(httpPost, metadata);
        httpPost.setConfig(reqConf);
        try {
            return sendRequest(httpPost, new ResponseHandler<Boolean>() {
                @Override
                public Boolean handleResponse(HttpResponse response) throws IOException {
                    try {
                        if (200 != response.getStatusLine().getStatusCode()) {
                            refreshAddressCache();
                            handleErrorResponse(response, httpPost);
                            Registry r = Lookout.registry();
                            r.counter(
                                r.createId(LOOKOUT_REPORT_FAIL_COUNT_ID).withTag(LOW_PRIORITY_TAG))
                                .inc();
                            return false;
                        } else {//success
                            logger.debug("report to lookout gateway ok.{}", httpPost.toString());
                        }
                    } finally {
                        EntityUtils.consumeQuietly(response.getEntity());
                    }
                    return true;
                }
            });
        } catch (IOException e) {
            //try with a new address
            refreshAddressCache();
            throw e;
        }

    }

    public  DefaultHttpRequestProcessor(AddressService addressService, MetricConfig metricConfig);

}