2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.protocol.framework;
10 import io.netty.util.concurrent.EventExecutor;
11 import io.netty.util.concurrent.Future;
13 import javax.annotation.concurrent.ThreadSafe;
15 import com.google.common.base.Preconditions;
18 * Utility ReconnectStrategy singleton, which will cause the reconnect process
23 public final class NeverReconnectStrategy implements ReconnectStrategy {
24 private final EventExecutor executor;
25 private final int timeout;
27 public NeverReconnectStrategy(final EventExecutor executor, final int timeout) {
28 Preconditions.checkArgument(timeout >= 0);
29 this.executor = Preconditions.checkNotNull(executor);
30 this.timeout = timeout;
34 public Future<Void> scheduleReconnect(final Throwable cause) {
35 return executor.newFailedFuture(new Throwable("Reconnect failed", cause));
39 public void reconnectSuccessful() {
44 public int getConnectTimeout() {