001/*
002 * Copyright © 2025 CUI-OpenSource-Software (info@cuioss.de)
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package de.cuioss.http.client.retry;
017
018/**
019 * Utility class providing factory methods for creating retry strategies.
020 * <p>
021 * This class breaks circular dependencies by providing static factory methods
022 * for retry strategy implementations without requiring the interface to depend
023 * on concrete implementations.
024 * </p>
025 */
026public final class RetryStrategies {
027
028    private RetryStrategies() {
029        // Utility class
030    }
031
032    /**
033     * Creates exponential backoff retry strategy with sensible defaults.
034     * This is the recommended strategy for most HTTP operations requiring retry.
035     *
036     * Default configuration:
037     * - Maximum attempts: 5
038     * - Initial delay: 1 second
039     * - Backoff multiplier: 2.0
040     * - Maximum delay: 1 minute
041     * - Jitter factor: 0.1 (±10% randomization)
042     *
043     * @return a retry strategy with exponential backoff and jitter
044     */
045    public static RetryStrategy exponentialBackoff() {
046        return ExponentialBackoffRetryStrategy.builder().build();
047    }
048}