public class FatalFailureConnectionStrategy extends Object implements ConnectionStrategy
Couple of examples are given below. The assumption is that there are three servers MAIN, DR1 and DR2. The 1. Currently the client is connected with DR1. A disconnect with DR1 occurs, and then the client tries connecting to DR2, MAIN and DR1. It attempts this for a preconfigured number of times (e.g. 3 times). So for example, the following events occur: --a. Connection attempt no 1 with DR2: failed --b. Connection attempt no 1 with MAIN: failed --c. Connection attempt no 1 with DR1: failed --d. Connection attempt no 2 with DR2: succeeded. No fatal failure event is raised. 2. Now the client is on DR2 and a disconnect with DR2 occurs. Following events occur --a. Connection attempt no 1 with MAIN: failed --b. Connection attempt no 1 with DR1: failed --c. Connection attempt no 1 with DR2: failed --d. Connection attempt no 2 with MAIN: failed --e. Connection attempt no 2 with DR1: failed --f. Connection attempt no 2 with DR2: failed --g. Connection attempt no 3 with MAIN: failed --h. Connection attempt no 3 with DR1: failed --i. Connection attempt no 3 with DR2: failed => Attempt 3 finished. Fatal Failure is raised
| Constructor and Description |
|---|
FatalFailureConnectionStrategy(int attempts) |
| Modifier and Type | Method and Description |
|---|---|
SocketChannel |
connect(String name,
SocketAddressSupplier socketAddressSupplier,
NetworkStatsListener<? extends NetworkContext> networkStatsListener,
boolean didLogIn,
FatalFailureMonitor fatalFailureMonitor) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitopenSocketChannel, socketChannel$equals, $fieldInfos, $hashCode, $toString, copyFrom, copyTo, deepCopy, fromFile, fromFile, fromFileAsMap, fromFileAsMap, fromHexString, fromString, getField, mergeToMap, readMarshallable, setField, streamFromFile, streamFromFile, writeMarshallablepublic FatalFailureConnectionStrategy(int attempts)
attempts - the number of attempts before a onFatalFailure() reported@Nullable public SocketChannel connect(@NotNull String name, @NotNull SocketAddressSupplier socketAddressSupplier, @Nullable NetworkStatsListener<? extends NetworkContext> networkStatsListener, boolean didLogIn, @Nullable FatalFailureMonitor fatalFailureMonitor) throws InterruptedException
connect in interface ConnectionStrategyname - the name of the connection, only used for loggingdidLogIn - was the last attempt successfull, was a login establishedInterruptedExceptionCopyright © 2017. All rights reserved.