public class FailoverProxy extends Object implements InvocationHandler
Modifier and Type | Field and Description |
---|---|
ReentrantReadWriteLock |
lock |
static String |
METHOD_CLOSED_EXPLICIT |
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_SET_READ_ONLY |
Constructor and Description |
---|
FailoverProxy(Listener listener,
ReentrantReadWriteLock lock) |
Modifier and Type | Method and Description |
---|---|
Listener |
getListener() |
boolean |
hasToHandleFailover(QueryException e)
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() |
public static final String METHOD_IS_EXPLICIT_CLOSED
public static final String METHOD_GET_OPTIONS
public static final String METHOD_GET_PROXY
public static final String METHOD_EXECUTE_QUERY
public static final String METHOD_SET_READ_ONLY
public static final String METHOD_IS_READ_ONLY
public static final String METHOD_CLOSED_EXPLICIT
public static final String METHOD_IS_CLOSED
public final ReentrantReadWriteLock lock
public FailoverProxy(Listener listener, ReentrantReadWriteLock lock) throws QueryException, SQLException
QueryException
SQLException
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke
in interface InvocationHandler
proxy
- the current protocolmethod
- the called method on the protocolargs
- methods parametersThrowable
- the method throwed error if not catch by failoverpublic boolean hasToHandleFailover(QueryException e)
e
- the Exceptionpublic void reconnect() throws SQLException
SQLException
public Listener getListener()
Copyright © 2015. All rights reserved.