<commit_before>package org.jvalue.commons.utils;


import java.net.HttpURLConnection;
import java.net.URL;

public final class HttpServiceCheck {

	private static final int DEFAULT_RETRIES = 50;
	private static final int DEFAULT_SLEEP_TIME_BETWEEN_RETRIES = 3000;

	public static boolean check(String url) {
		return doCheck(url, DEFAULT_RETRIES, DEFAULT_SLEEP_TIME_BETWEEN_RETRIES);
	}


	public static boolean check(String url, int retries, int sleepTimeBetweenRetries) {
		return doCheck(url, retries, sleepTimeBetweenRetries);
	}


	private static boolean doCheck(String url, int retries, int sleepTimeBetweenRetries) {
		int retryCounter = retries;

		do {<commit_msg>Add JavaDoc comments to HttpServiceCheck class<commit_after>package org.jvalue.commons.utils;


import java.net.HttpURLConnection;
import java.net.URL;

/**
 * Check if a HTTP service is available.
 * If a HTTP connection cant't be established, it
 * will wait a and retry to connect to the service.
 */
public final class HttpServiceCheck {

	public static final int DEFAULT_RETRIES = 50;
	public static final int DEFAULT_SLEEP_TIME_BETWEEN_RETRIES = 3000;

	/**
	 * Check if HTTP service is available.
	 * Default amount of retries are {@value #DEFAULT_RETRIES}.
	 * Default time to wait until next retry is {@value #DEFAULT_SLEEP_TIME_BETWEEN_RETRIES}.
	 * @param url URL of the HTTP service to check.
	 * @return true if the service is available and false if not.
	 */
	public static boolean check(String url) {
		return doCheck(url, DEFAULT_RETRIES, DEFAULT_SLEEP_TIME_BETWEEN_RETRIES);
	}

	/**
	 * Check if HTTP service is available.
	 * @param url URL of the HTTP service to check
	 * @param retries amount of retries until fail
	 * @param sleepTimeBetweenRetries time to wait until next retry in milliseconds
	 * @return true if the service is available and false if not.
	 */
	public static boolean check(String url, int retries, int sleepTimeBetweenRetries) {
		return doCheck(url, retries, sleepTimeBetweenRetries);
	}


	private static boolean doCheck(String url, int retries, int sleepTimeBetweenRetries) {
		int retryCounter = retries;

		do {
{'fraction_non_alphanumeric': 0.0680431722196152, 'fraction_numerical': 0.005631159080244017, 'mean_word_length': 4.670212765957447, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3020404', 'n_tokens_mistral': 679, 'n_tokens_neox': 622, 'n_words': 230}