public class ClusterAwareWriterFailoverHandler extends java.lang.Object implements IWriterFailoverHandler
Writer Failover Process goal is to re-establish connection to a writer. Connection to a writer may be disrupted either by temporary network issue, or due to writer host unavailability during cluster failover. This handler tries both approaches in parallel: 1) try to re-connect to the same writer host, 2) try to update cluster topology and connect to a newly elected writer.
| Modifier and Type | Field and Description |
|---|---|
protected IConnectionProvider |
connectionProvider |
protected java.util.Map<java.lang.String,java.lang.String> |
initialConnectionProps |
protected Log |
log
The logger we're going to use.
|
protected int |
maxFailoverTimeoutMs |
protected static Log |
NULL_LOGGER
Null logger shared by all connections at startup.
|
protected IReaderFailoverHandler |
readerFailoverHandler |
protected int |
readTopologyIntervalMs |
protected int |
reconnectWriterIntervalMs |
protected ITopologyService |
topologyService |
| Constructor and Description |
|---|
ClusterAwareWriterFailoverHandler(ITopologyService topologyService,
IConnectionProvider connectionProvider,
IReaderFailoverHandler readerFailoverHandler,
java.util.Map<java.lang.String,java.lang.String> initialConnectionProps,
int failoverTimeoutMs,
int readTopologyIntervalMs,
int reconnectWriterIntervalMs,
Log log)
ClusterAwareWriterFailoverHandler constructor.
|
ClusterAwareWriterFailoverHandler(ITopologyService topologyService,
IConnectionProvider connectionProvider,
IReaderFailoverHandler readerFailoverHandler,
java.util.Map<java.lang.String,java.lang.String> initialConnectionProps,
Log log)
ClusterAwareWriterFailoverHandler constructor.
|
| Modifier and Type | Method and Description |
|---|---|
WriterFailoverResult |
failover(java.util.List<HostInfo> currentTopology)
Called to start Writer Failover Process.
|
protected static final Log NULL_LOGGER
protected transient Log log
protected int maxFailoverTimeoutMs
protected int readTopologyIntervalMs
protected int reconnectWriterIntervalMs
protected java.util.Map<java.lang.String,java.lang.String> initialConnectionProps
protected ITopologyService topologyService
protected IConnectionProvider connectionProvider
protected IReaderFailoverHandler readerFailoverHandler
public ClusterAwareWriterFailoverHandler(ITopologyService topologyService, IConnectionProvider connectionProvider, IReaderFailoverHandler readerFailoverHandler, java.util.Map<java.lang.String,java.lang.String> initialConnectionProps, Log log)
public ClusterAwareWriterFailoverHandler(ITopologyService topologyService, IConnectionProvider connectionProvider, IReaderFailoverHandler readerFailoverHandler, java.util.Map<java.lang.String,java.lang.String> initialConnectionProps, int failoverTimeoutMs, int readTopologyIntervalMs, int reconnectWriterIntervalMs, Log log)
public WriterFailoverResult failover(java.util.List<HostInfo> currentTopology) throws java.sql.SQLException
failover in interface IWriterFailoverHandlercurrentTopology - Cluster current topologyWriterFailoverResult The results of this process.java.sql.SQLException