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.lcn.internal.connection;
15 import java.util.concurrent.TimeUnit;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
21 * This state is active when the connection failed. A grace period is enforced to prevent fast cycling through the
24 * @author Fabian Wolter - Initial Contribution
27 public class ConnectionStateGracePeriodBeforeReconnect extends AbstractConnectionState {
28 private static final int RECONNECT_GRACE_PERIOD_SEC = 5;
30 public ConnectionStateGracePeriodBeforeReconnect(ConnectionStateMachine context) {
35 public void startWorking() {
38 addTimer(getScheduler().schedule(() -> nextState(ConnectionStateConnecting::new), RECONNECT_GRACE_PERIOD_SEC,
43 public void onPckMessageReceived(String data) {
48 public void handleConnectionFailed(@Nullable Throwable e) {