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.retry;
15 import java.util.function.Consumer;
16 import java.util.function.Supplier;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
22 * {@link RetryStrategy} implementation wrapping the consecutive execution of two retry strategies.
24 * @author Björn Lange and Roland Edelhoff - Initial contribution
27 public class RetryStrategyCombiner implements RetryStrategy {
28 private final RetryStrategy first;
29 private final RetryStrategy second;
32 * Creates a new {@link RetryStrategy} combining the given ones.
34 * @param first First strategy to execute.
35 * @param second Strategy to execute in each execution of {@code first}.
37 public RetryStrategyCombiner(RetryStrategy first, RetryStrategy second) {
43 public <@Nullable T> T performRetryableOperation(Supplier<T> operation, Consumer<Exception> onException) {
44 return first.performRetryableOperation(() -> second.performRetryableOperation(operation, onException),