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 static WriterFailoverResult |
DEFAULT_RESULT |
protected java.util.Map<java.lang.String,HostAvailability> |
hostAvailabilityMap |
protected java.util.Properties |
initialConnectionProps |
protected int |
maxFailoverTimeoutMs |
protected PluginService |
pluginService |
protected ReaderFailoverHandler |
readerFailoverHandler |
protected int |
readTopologyIntervalMs |
protected int |
reconnectWriterIntervalMs |
protected FullServicesContainer |
servicesContainer |
| Constructor and Description |
|---|
ClusterAwareWriterFailoverHandler(FullServicesContainer servicesContainer,
ReaderFailoverHandler readerFailoverHandler,
java.util.Properties initialConnectionProps) |
ClusterAwareWriterFailoverHandler(FullServicesContainer servicesContainer,
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.
|
java.util.Map<java.lang.String,HostAvailability> |
getHostAvailabilityMap()
Get the host availability map for the failover handler.
|
protected FullServicesContainer |
newServicesContainer() |
protected static final WriterFailoverResult DEFAULT_RESULT
protected final java.util.Properties initialConnectionProps
protected final FullServicesContainer servicesContainer
protected final PluginService pluginService
protected final ReaderFailoverHandler readerFailoverHandler
protected final java.util.Map<java.lang.String,HostAvailability> hostAvailabilityMap
protected int maxFailoverTimeoutMs
protected int readTopologyIntervalMs
protected int reconnectWriterIntervalMs
public ClusterAwareWriterFailoverHandler(FullServicesContainer servicesContainer, ReaderFailoverHandler readerFailoverHandler, java.util.Properties initialConnectionProps)
public ClusterAwareWriterFailoverHandler(FullServicesContainer servicesContainer, ReaderFailoverHandler readerFailoverHandler, java.util.Properties initialConnectionProps, int failoverTimeoutMs, int readTopologyIntervalMs, int reconnectWriterIntervalMs)
public java.util.Map<java.lang.String,HostAvailability> getHostAvailabilityMap()
WriterFailoverHandlergetHostAvailabilityMap in interface WriterFailoverHandlerpublic WriterFailoverResult failover(java.util.List<HostSpec> currentTopology) throws java.sql.SQLException
WriterFailoverHandlerfailover in interface WriterFailoverHandlercurrentTopology - Cluster current topologyWriterFailoverResult The results of this process.java.sql.SQLException - indicating whether the failover attempt was successful.protected FullServicesContainer newServicesContainer() throws java.sql.SQLException
java.sql.SQLException