public class FatalFailureConnectionStrategy extends AbstractConnectionStrategy
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 implies: Attempt 3 finished. Fatal Failure is raised
clientConnectionMonitor, localBindingNetworkInterface, localBindingProtocolFamily, localSocketBindingHost, localSocketBindingPort, tcpBufferSize| Constructor and Description |
|---|
FatalFailureConnectionStrategy(int attempts,
boolean blocking) |
| Modifier and Type | Method and Description |
|---|---|
ClientConnectionMonitor |
clientConnectionMonitor() |
FatalFailureConnectionStrategy |
clientConnectionMonitor(ClientConnectionMonitor fatalFailureMonitor) |
@Nullable ChronicleSocketChannel |
connect(@NotNull String name,
@NotNull SocketAddressSupplier socketAddressSupplier,
boolean didLogIn,
@Nullable FatalFailureMonitor fatalFailureMonitor)
Connects and returns a new SocketChannel.
|
close, defaultMaxPauseSec, defaultMinPauseSec, isClosed, localBindingNetworkInterface, localBindingProtocolFamily, localSocketBinding, localSocketBindingHost, localSocketBindingPort, openreadMarshallable, unexpectedField, writeMarshallableusesSelfDescribingMessageequals, hashCode, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitmaxPauseSec, minPauseSec, openSocketChannel, openSocketChannel, pauseBeforeReconnect, pauseMillisBeforeReconnect, socketChannel, throwExceptionIfClosed$equals, $fieldInfoMap, $fieldInfos, $hashCode, $toString, className, copyTo, deepCopy, fromFile, fromFile, fromString, fromString, fromString, getField, getLongField, mergeToMap, readMarshallable, reset, setField, setLongField, streamFromFile, streamFromFile, writeMarshallablebinaryLengthLength, writeValuepublic FatalFailureConnectionStrategy(int attempts,
boolean blocking)
attempts - the number of attempts before a onFatalFailure() reportedpublic ClientConnectionMonitor clientConnectionMonitor()
public FatalFailureConnectionStrategy clientConnectionMonitor(ClientConnectionMonitor fatalFailureMonitor)
@Nullable public @Nullable ChronicleSocketChannel connect(@NotNull @NotNull String name, @NotNull @NotNull SocketAddressSupplier socketAddressSupplier, boolean didLogIn, @Nullable @Nullable FatalFailureMonitor fatalFailureMonitor) throws InterruptedException
ConnectionStrategyname - the name of the connection, only used for loggingsocketAddressSupplier - to use for addressdidLogIn - was the last attempt successful, was a login establishedfatalFailureMonitor - this is invoked on failuresInterruptedException - if the channel is interrupted.Copyright © 2023. All rights reserved.