public class ClusterAwareWriterFailoverHandler extends java.lang.Object implements WriterFailoverHandler
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 java.util.Properties |
initialConnectionProps |
protected int |
maxFailoverTimeoutMs |
protected PluginService |
pluginService |
protected ReaderFailoverHandler |
readerFailoverHandler |
protected int |
readTopologyIntervalMs |
protected int |
reconnectWriterIntervalMs |
| Constructor and Description |
|---|
ClusterAwareWriterFailoverHandler(PluginService pluginService,
ReaderFailoverHandler readerFailoverHandler,
java.util.Properties initialConnectionProps) |
ClusterAwareWriterFailoverHandler(PluginService pluginService,
ReaderFailoverHandler readerFailoverHandler,
java.util.Properties initialConnectionProps,
int failoverTimeoutMs,
int readTopologyIntervalMs,
int reconnectWriterIntervalMs) |
| Modifier and Type | Method and Description |
|---|---|
WriterFailoverResult |
failover(java.util.List<HostSpec> currentTopology)
Called to start Writer Failover Process.
|
protected int maxFailoverTimeoutMs
protected int readTopologyIntervalMs
protected int reconnectWriterIntervalMs
protected java.util.Properties initialConnectionProps
protected PluginService pluginService
protected ReaderFailoverHandler readerFailoverHandler
public ClusterAwareWriterFailoverHandler(PluginService pluginService, ReaderFailoverHandler readerFailoverHandler, java.util.Properties initialConnectionProps)
public ClusterAwareWriterFailoverHandler(PluginService pluginService, ReaderFailoverHandler readerFailoverHandler, java.util.Properties initialConnectionProps, int failoverTimeoutMs, int readTopologyIntervalMs, int reconnectWriterIntervalMs)
public WriterFailoverResult failover(java.util.List<HostSpec> currentTopology) throws java.sql.SQLException
failover in interface WriterFailoverHandlercurrentTopology - Cluster current topologyWriterFailoverResult The results of this process.java.sql.SQLException - indicating whether the failover attempt was successful.