public class ReplicationConnectionProxy extends MultiHostConnectionProxy implements PingTarget
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
allowReplicaDownConnections |
protected boolean |
allowSourceDownConnections |
protected boolean |
enableJMX |
protected boolean |
readFromSourceWhenNoReplicas |
protected boolean |
readFromSourceWhenNoReplicasOriginal |
protected boolean |
readOnly |
protected LoadBalancedConnection |
replicasConnection |
protected LoadBalancedConnection |
sourceConnection |
autoReconnect, closedExplicitly, closedReason, connectionUrl, currentConnection, hostsList, isClosed, lastExceptionDealtWith, thisAsConnection| Modifier and Type | Method and Description |
|---|---|
void |
addReplicaHost(java.lang.String hostPortPair) |
void |
addSlaveHost(java.lang.String hostPortPair)
Deprecated.
|
static ReplicationConnection |
createProxyInstance(ConnectionUrl connectionUrl)
Static factory to create
ReplicationConnection instances. |
protected void |
doAbort(java.util.concurrent.Executor executor)
Executes a abort() invocation;
|
protected void |
doAbortInternal()
Executes a abortInternal() invocation;
|
protected void |
doClose()
Executes a close() invocation;
|
void |
doPing()
Pings both l/b connections.
|
long |
getConnectionGroupId() |
JdbcConnection |
getCurrentConnection() |
JdbcConnection |
getMasterConnection()
Deprecated.
|
JdbcConnection |
getReplicasConnection() |
JdbcConnection |
getSlavesConnection()
Deprecated.
|
JdbcConnection |
getSourceConnection() |
protected java.lang.Object |
invokeMore(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
Proxies method invocation on the java.sql.Connection interface.
|
boolean |
isHostMaster(java.lang.String hostPortPair)
Deprecated.
|
boolean |
isHostReplica(java.lang.String hostPortPair) |
boolean |
isHostSlave(java.lang.String hostPortPair)
Deprecated.
|
boolean |
isHostSource(java.lang.String hostPortPair) |
boolean |
isReadOnly() |
boolean |
isReplicasConnection()
Checks if current connection is the replicas l/b connection.
|
boolean |
isSlavesConnection()
Deprecated.
|
boolean |
isSourceConnection()
Checks if current connection is the sources l/b connection.
|
protected void |
pickNewConnection()
Picks the "best" connection to use from now on.
|
void |
promoteReplicaToSource(java.lang.String hostPortPair) |
void |
promoteSlaveToMaster(java.lang.String hostPortPair)
Deprecated.
|
protected void |
propagateProxyDown(JdbcConnection proxyConn)
Propagates the connection proxy down through all live connections.
|
void |
removeMasterHost(java.lang.String hostPortPair)
Deprecated.
|
void |
removeMasterHost(java.lang.String hostPortPair,
boolean waitUntilNotInUse)
Deprecated.
|
void |
removeMasterHost(java.lang.String hostPortPair,
boolean waitUntilNotInUse,
boolean isNowReplica)
Deprecated.
|
void |
removeReplica(java.lang.String hostPortPair) |
void |
removeReplica(java.lang.String hostPortPair,
boolean closeGently) |
void |
removeSlave(java.lang.String hostPortPair)
Deprecated.
|
void |
removeSlave(java.lang.String hostPortPair,
boolean closeGently)
Deprecated.
|
void |
removeSourceHost(java.lang.String hostPortPair) |
void |
removeSourceHost(java.lang.String hostPortPair,
boolean waitUntilNotInUse) |
void |
removeSourceHost(java.lang.String hostPortPair,
boolean waitUntilNotInUse,
boolean isNowReplica) |
void |
setReadOnly(boolean readOnly) |
protected boolean |
shouldExceptionTriggerConnectionSwitch(java.lang.Throwable t)
Has no use in replication connections.
|
protected void |
syncSessionState(JdbcConnection source,
JdbcConnection target,
boolean readonly)
Synchronizes session state between two connections, allowing to override the read-only status.
|
allowedOnClosedConnection, createConnectionForHost, dealWithInvocationException, getNewJdbcInterfaceProxy, getParentProxy, getProxy, invalidateConnection, invalidateCurrentConnection, invoke, proxyIfReturnTypeIsJdbcInterface, setProxyprotected boolean enableJMX
protected boolean allowSourceDownConnections
protected boolean allowReplicaDownConnections
protected boolean readFromSourceWhenNoReplicas
protected boolean readFromSourceWhenNoReplicasOriginal
protected boolean readOnly
protected LoadBalancedConnection sourceConnection
protected LoadBalancedConnection replicasConnection
public static ReplicationConnection createProxyInstance(ConnectionUrl connectionUrl) throws java.sql.SQLException
ReplicationConnection instances.connectionUrl - The connection URL containing the hosts in a replication setup.ReplicationConnection proxy.java.sql.SQLException - if an error occursprotected void propagateProxyDown(JdbcConnection proxyConn)
propagateProxyDown in class MultiHostConnectionProxyproxyConn - The top level connection in the multi-host connections chain.protected boolean shouldExceptionTriggerConnectionSwitch(java.lang.Throwable t)
false.shouldExceptionTriggerConnectionSwitch in class MultiHostConnectionProxyt - The Exception instance to check.public boolean isSourceConnection()
isSourceConnection in class MultiHostConnectionProxypublic boolean isReplicasConnection()
@Deprecated public boolean isSlavesConnection()
isReplicasConnection() instead.protected void pickNewConnection()
throws java.sql.SQLException
MultiHostConnectionProxypickNewConnection in class MultiHostConnectionProxyjava.sql.SQLException - if an error occursprotected void syncSessionState(JdbcConnection source, JdbcConnection target, boolean readonly) throws java.sql.SQLException
MultiHostConnectionProxysyncSessionState in class MultiHostConnectionProxysource - The connection where to get state from.target - The connection where to set state.readonly - The new read-only status.java.sql.SQLException - if an error occursprotected void doClose()
throws java.sql.SQLException
MultiHostConnectionProxydoClose in class MultiHostConnectionProxyjava.sql.SQLException - if an error occursprotected void doAbortInternal()
throws java.sql.SQLException
MultiHostConnectionProxydoAbortInternal in class MultiHostConnectionProxyjava.sql.SQLException - if an error occursprotected void doAbort(java.util.concurrent.Executor executor)
throws java.sql.SQLException
MultiHostConnectionProxydoAbort in class MultiHostConnectionProxyexecutor - executorjava.sql.SQLException - if an error occursprotected java.lang.Object invokeMore(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
throws java.lang.Throwable
invokeMore in class MultiHostConnectionProxyproxy - proxy objectmethod - method to invokeargs - method parametersjava.lang.Throwable - if an error occurspublic void doPing()
throws java.sql.SQLException
doPing in interface PingTargetjava.sql.SQLExceptionpublic JdbcConnection getCurrentConnection()
public long getConnectionGroupId()
public JdbcConnection getSourceConnection()
@Deprecated public JdbcConnection getMasterConnection()
getSourceConnection() instead.JdbcConnectionpublic void promoteReplicaToSource(java.lang.String hostPortPair)
throws java.sql.SQLException
java.sql.SQLException@Deprecated
public void promoteSlaveToMaster(java.lang.String hostPortPair)
throws java.sql.SQLException
promoteReplicaToSource(String) instead.hostPortPair - host:portjava.sql.SQLExceptionpublic void removeSourceHost(java.lang.String hostPortPair)
throws java.sql.SQLException
java.sql.SQLException@Deprecated
public void removeMasterHost(java.lang.String hostPortPair)
throws java.sql.SQLException
removeSourceHost(String) instead.hostPortPair - host:portjava.sql.SQLExceptionpublic void removeSourceHost(java.lang.String hostPortPair,
boolean waitUntilNotInUse)
throws java.sql.SQLException
java.sql.SQLException@Deprecated
public void removeMasterHost(java.lang.String hostPortPair,
boolean waitUntilNotInUse)
throws java.sql.SQLException
removeSourceHost(String, boolean) instead.hostPortPair - host:portwaitUntilNotInUse - remove only when not in usejava.sql.SQLExceptionpublic void removeSourceHost(java.lang.String hostPortPair,
boolean waitUntilNotInUse,
boolean isNowReplica)
throws java.sql.SQLException
java.sql.SQLException@Deprecated
public void removeMasterHost(java.lang.String hostPortPair,
boolean waitUntilNotInUse,
boolean isNowReplica)
throws java.sql.SQLException
removeSourceHost(String, boolean, boolean) instead.hostPortPair - host:portwaitUntilNotInUse - remove only when not in useisNowReplica - place to replicasjava.sql.SQLExceptionpublic boolean isHostSource(java.lang.String hostPortPair)
@Deprecated public boolean isHostMaster(java.lang.String hostPortPair)
isHostSource(String) instead.hostPortPair - host:portpublic JdbcConnection getReplicasConnection()
@Deprecated public JdbcConnection getSlavesConnection()
getReplicasConnection() instead.JdbcConnectionpublic void addReplicaHost(java.lang.String hostPortPair)
throws java.sql.SQLException
java.sql.SQLException@Deprecated
public void addSlaveHost(java.lang.String hostPortPair)
throws java.sql.SQLException
addReplicaHost(String) instead.hostPortPair - host:portjava.sql.SQLExceptionpublic void removeReplica(java.lang.String hostPortPair)
throws java.sql.SQLException
java.sql.SQLException@Deprecated
public void removeSlave(java.lang.String hostPortPair)
throws java.sql.SQLException
removeReplica(String) instead.hostPortPair - host:portjava.sql.SQLExceptionpublic void removeReplica(java.lang.String hostPortPair,
boolean closeGently)
throws java.sql.SQLException
java.sql.SQLException@Deprecated
public void removeSlave(java.lang.String hostPortPair,
boolean closeGently)
throws java.sql.SQLException
removeReplica(String, boolean) instead.hostPortPair - host:portcloseGently - optionjava.sql.SQLExceptionpublic boolean isHostReplica(java.lang.String hostPortPair)
@Deprecated public boolean isHostSlave(java.lang.String hostPortPair)
isHostReplica(String) instead.hostPortPair - host:portpublic void setReadOnly(boolean readOnly)
throws java.sql.SQLException
java.sql.SQLExceptionpublic boolean isReadOnly()
throws java.sql.SQLException
java.sql.SQLException