2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.mielecloud.internal.webservice.sse;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
18 * A strategy computing the wait time between multiple connection attempts.
20 * @author Björn Lange - Initial contribution
23 interface BackoffStrategy {
25 * Gets the minimal number of seconds to wait until retrying an operation. This is the lower bound of the value
26 * returned by {@link #getSecondsUntilRetry(int)}.
28 * @return The minimal number of seconds to wait until retrying an operation. Always larger or equal to zero, always
29 * smaller than {@link #getMaximumSecondsUntilRetry()}.
31 long getMinimumSecondsUntilRetry();
34 * Gets the maximal number of seconds to wait until retrying an operation. This is the upper bound of the value
35 * returned by {@link #getSecondsUntilRetry(int)}.
37 * @return The maximal number of seconds to wait until retrying an operation. Always larger or equal to zero, always
38 * larger than {@link #getMinimumSecondsUntilRetry()}.
40 long getMaximumSecondsUntilRetry();
43 * Gets the number of seconds until a retryable operation is performed. The value returned by this method is within
44 * the interval defined by {@link #getMinimumSecondsUntilRetry()} and {@link #getMaximumSecondsUntilRetry()}.
46 * @param failedConnectionAttempts The number of failed attempts.
47 * @return The number of seconds to wait before making the next attempt.
49 long getSecondsUntilRetry(int failedAttempts);