com.mysql.jdbc
Class FailoverConnectionProxy

java.lang.Object
  extended by com.mysql.jdbc.LoadBalancingConnectionProxy
      extended by com.mysql.jdbc.FailoverConnectionProxy
All Implemented Interfaces:
PingTarget, java.lang.reflect.InvocationHandler

public class FailoverConnectionProxy
extends LoadBalancingConnectionProxy


Nested Class Summary
(package private)  class FailoverConnectionProxy.FailoverInvocationHandler
           
 
Nested classes/interfaces inherited from class com.mysql.jdbc.LoadBalancingConnectionProxy
LoadBalancingConnectionProxy.ConnectionErrorFiringInvocationHandler
 
Field Summary
(package private)  boolean failedOver
           
(package private)  boolean hasTriedMaster
           
(package private)  boolean preferSlaveDuringFailover
           
(package private)  long queriesIssuedFailedOver
           
 
Fields inherited from class com.mysql.jdbc.LoadBalancingConnectionProxy
BLACKLIST_TIMEOUT_PROPERTY_KEY, currentConn, hostList, liveConnections
 
Constructor Summary
FailoverConnectionProxy(java.util.List<java.lang.String> hosts, java.util.Properties props)
           
 
Method Summary
protected  LoadBalancingConnectionProxy.ConnectionErrorFiringInvocationHandler createConnectionProxy(java.lang.Object toProxy)
           
(package private)  void dealWithInvocationException(java.lang.reflect.InvocationTargetException e)
           
(package private)  void invalidateCurrentConnection()
          Closes current connection and removes it from required mappings.
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
           
protected  void pickNewConnection()
          Picks the "best" connection to use for the next transaction based on the BalanceStrategy in use.
 
Methods inherited from class com.mysql.jdbc.LoadBalancingConnectionProxy
addHost, addToGlobalBlacklist, addToGlobalBlacklist, createConnectionForHost, doPing, getActivePhysicalConnectionCount, getConnectionGroupProxyID, getCurrentActiveHost, getCurrentTransactionDuration, getGlobalBlacklist, getLastUsed, getTotalPhysicalConnectionCount, getTransactionCount, inTransaction, invalidateConnection, invoke, isGlobalBlacklistEnabled, proxyIfInterfaceIsJdbc, removeHost, removeHostWhenNotInUse, shouldExceptionTriggerFailover, syncSessionState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

failedOver

boolean failedOver

hasTriedMaster

boolean hasTriedMaster

preferSlaveDuringFailover

boolean preferSlaveDuringFailover

queriesIssuedFailedOver

long queriesIssuedFailedOver
Constructor Detail

FailoverConnectionProxy

FailoverConnectionProxy(java.util.List<java.lang.String> hosts,
                        java.util.Properties props)
                  throws java.sql.SQLException
Throws:
java.sql.SQLException
Method Detail

createConnectionProxy

protected LoadBalancingConnectionProxy.ConnectionErrorFiringInvocationHandler createConnectionProxy(java.lang.Object toProxy)
Overrides:
createConnectionProxy in class LoadBalancingConnectionProxy

dealWithInvocationException

void dealWithInvocationException(java.lang.reflect.InvocationTargetException e)
                           throws java.sql.SQLException,
                                  java.lang.Throwable,
                                  java.lang.reflect.InvocationTargetException
Overrides:
dealWithInvocationException in class LoadBalancingConnectionProxy
Throws:
java.sql.SQLException
java.lang.Throwable
java.lang.reflect.InvocationTargetException

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] args)
                        throws java.lang.Throwable
Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Overrides:
invoke in class LoadBalancingConnectionProxy
Throws:
java.lang.Throwable

invalidateCurrentConnection

void invalidateCurrentConnection()
                           throws java.sql.SQLException
Description copied from class: LoadBalancingConnectionProxy
Closes current connection and removes it from required mappings.

Overrides:
invalidateCurrentConnection in class LoadBalancingConnectionProxy
Throws:
java.sql.SQLException

pickNewConnection

protected void pickNewConnection()
                          throws java.sql.SQLException
Description copied from class: LoadBalancingConnectionProxy
Picks the "best" connection to use for the next transaction based on the BalanceStrategy in use.

Overrides:
pickNewConnection in class LoadBalancingConnectionProxy
Throws:
java.sql.SQLException