## org.mariadb.jdbc.internal.failover
Class FailoverProxy

    java.lang.Object
      org.mariadb.jdbc.internal.failover.FailoverProxy

All Implemented Interfaces:
  InvocationHandler

    public class FailoverProxy

extends Object
implements InvocationHandler

Field Summary
`ReentrantLock` `lock`
`static String` `METHOD_CLOSED_EXPLICIT`
`static String` `METHOD_COM_MULTI_PREPARE_EXECUTES`
`static String` `METHOD_EXECUTE_PREPARED_QUERY`
`static String` `METHOD_EXECUTE_QUERY`
`static String` `METHOD_GET_OPTIONS`
`static String` `METHOD_GET_PROXY`
`static String` `METHOD_IS_CLOSED`
`static String` `METHOD_IS_EXPLICIT_CLOSED`
`static String` `METHOD_IS_READ_ONLY`
`static String` `METHOD_PROLOG_PROXY`
`static String` `METHOD_SET_READ_ONLY`

Constructor Summary
`FailoverProxy(Listener listener, ReentrantLock lock)` Proxy constructor.

Method Summary
`Listener` `getListener()`

`boolean`

`hasToHandleFailover(SQLException exception)`
Check if this Sqlerror is a connection exception. if that's the case, must be handle by failover error codes : 08000 : connection exception 08001 : SQL client unable to establish SQL connection 08002 : connection name in use 08003 : connection does not exist 08004 : SQL server rejected SQL connection 08006 : connection failure 08007 : transaction resolution unknown 70100 : connection was killed

`Object` `invoke(Object proxy, Method method, Object[] args)` Proxy that catch Protocol call, to permit to catch errors and handle failover when multiple hosts.
`void` `reconnect()` Launch reconnect implementation.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### METHOD_IS_EXPLICIT_CLOSED

    public static final String METHOD_IS_EXPLICIT_CLOSED

See Also:
  Constant Field Values

### METHOD_GET_OPTIONS

    public static final String METHOD_GET_OPTIONS

See Also:
  Constant Field Values

### METHOD_GET_PROXY

    public static final String METHOD_GET_PROXY

See Also:
  Constant Field Values

### METHOD_EXECUTE_QUERY

    public static final String METHOD_EXECUTE_QUERY

See Also:
  Constant Field Values

### METHOD_SET_READ_ONLY

    public static final String METHOD_SET_READ_ONLY

See Also:
  Constant Field Values

### METHOD_IS_READ_ONLY

    public static final String METHOD_IS_READ_ONLY

See Also:
  Constant Field Values

### METHOD_CLOSED_EXPLICIT

    public static final String METHOD_CLOSED_EXPLICIT

See Also:
  Constant Field Values

### METHOD_IS_CLOSED

    public static final String METHOD_IS_CLOSED

See Also:
  Constant Field Values

### METHOD_EXECUTE_PREPARED_QUERY

    public static final String METHOD_EXECUTE_PREPARED_QUERY

See Also:
  Constant Field Values

### METHOD_COM_MULTI_PREPARE_EXECUTES

    public static final String METHOD_COM_MULTI_PREPARE_EXECUTES

See Also:
  Constant Field Values

### METHOD_PROLOG_PROXY

    public static final String METHOD_PROLOG_PROXY

See Also:
  Constant Field Values

### lock

    public final ReentrantLock lock

Constructor Detail

### FailoverProxy

    public FailoverProxy(Listener listener,
                         ReentrantLock lock)
                  throws SQLException

  Proxy constructor.

  Parameters:
    `listener` - failover implementation.
    `lock` - synchronisation lock
  Throws:
    `SQLException` - if connection error occur

Method Detail

### invoke

    public Object invoke(Object proxy,
                         Method method,
                         Object[] args)
                  throws Throwable

  Proxy that catch Protocol call, to permit to catch errors and handle failover when multiple hosts.

  Specified by:
    `invoke` in interface `InvocationHandler`
  Parameters:
    `proxy` - the current protocol
    `method` - the called method on the protocol
    `args` - methods parameters
  Returns:
    protocol method result
  Throws:
    `Throwable` - the method throwed error if not catch by failover

### hasToHandleFailover

    public boolean hasToHandleFailover(SQLException exception)

  Check if this Sqlerror is a connection exception. if that's the case, must be handle by failover

  error codes : 08000 : connection exception 08001 : SQL client unable to establish SQL connection 08002 : connection name in use 08003 : connection does not exist 08004 : SQL server rejected SQL connection 08006 : connection failure 08007 : transaction resolution unknown 70100 : connection was killed

  Parameters:
    `exception` - the Exception
  Returns:
    true if there has been a connection error that must be handled by failover

### reconnect

    public void reconnect()
                   throws SQLException

  Launch reconnect implementation.

  Throws:
    `SQLException` - exception

### getListener

    public Listener getListener()

Copyright © 2017. All rights reserved.