All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.trimble.id.HttpClientConfiguration Maven / Gradle / Ivy

Go to download

Trimble Identity OAuth Client library holds the client classes that are used for communicating with Trimble Identity Service

The newest version!
package com.trimble.id;

import java.time.Duration;

/**
 * Configuration for the HttpClient.
 * The code retries if the response status code is in the 5xx range. This
 * indicates server-side errors, such as internal server errors, bad gateway,
 * service unavailable, etc.
 * The code retries if an IOException occurs during the request. This can happen
 * due to network issues, timeouts, or other I/O problems.
 */
public class HttpClientConfiguration {

    /**
     * Number of retries for HTTP calls with a retry-able response.
     * The code retries if the response status code is in the 5xx range. This
     * indicates server-side errors, such as internal server errors, bad gateway,
     * service unavailable, etc.
     * 
     */
    int retries = 3;

    /**
     * Time to wait between retries.
     */
    Duration retryInterval = Duration.ofSeconds(5);

    /**
     * Timeout used for Http calls.
     */
    Duration httpTimeout = Duration.ofMinutes(5);

    public int getRetries() {
        return retries;
    }

    /**
     * Set the number of retries for HTTP calls with a retry-able response.
     * Default is 3.
     * 
     * @param retries - no: of retries
     */
    public void setRetries(int retries) {
        this.retries = retries;
    }

    public Duration getRetryInterval() {
        return retryInterval;
    }

    /**
     * Set the time to wait between retries.
     * Default is 5 seconds.
     * 
     * @param retryInterval - Duration
     */
    public void setRetryInterval(Duration retryInterval) {
        this.retryInterval = retryInterval;
    }

    public Duration getHttpTimeout() {
        return httpTimeout;
    }

    /**
     * Set the timeout used for Http calls.
     * Default is 5 minutes.
     * 
     * @param httpTimeout - Duration
     */
    public void setHttpTimeout(Duration httpTimeout) {
        this.httpTimeout = httpTimeout;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy