private void sendGroupOfResults()

in asterix-bad/src/main/java/org/apache/asterix/bad/runtime/operators/NotifyBrokerRuntime.java [138:169]


    private void sendGroupOfResults(String endpoint) {
        String urlParameters = createData(endpoint);
        ExecutorService executor = Executors.newSingleThreadExecutor();
        executor.submit(() -> {
            try {
                //Create connection
                URL url = new URL(endpoint);
                HttpURLConnection connection = (HttpURLConnection) url.openConnection();
                connection.setRequestMethod("POST");
                connection.setRequestProperty("Content-Type", "application/json");

                connection.setRequestProperty("Content-Length", Integer.toString(urlParameters.getBytes().length));
                connection.setRequestProperty("Content-Language", "en-US");

                connection.setUseCaches(false);
                connection.setDoOutput(true);
                connection.setConnectTimeout(500);
                DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
                wr.writeBytes(urlParameters);
                if (LOGGER.isLoggable(Level.INFO)) {
                    int responseCode = connection.getResponseCode();
                    LOGGER.info("\nSending 'POST' request to URL : " + url);
                    LOGGER.info("Post parameters : " + urlParameters);
                    LOGGER.info("Response Code : " + responseCode);
                }
                wr.close();
                connection.disconnect();
            } catch (Exception e) {
                LOGGER.log(Level.WARNING, "Channel Failed to connect to Broker.");
            }
        });
    }