| Modifier and Type | Class and Description |
|---|---|
| pack-priv class | MultiHostConnectionProxy.
Proxy class to intercept and deal with errors that may occur in any object bound to the current connection. |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv String | |
| protected ConnectionUrl | |
| pack-priv JdbcConnection | |
| pack-priv List | |
| pack-priv boolean | |
| protected Throwable | |
| private final Lock | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| pack-priv JdbcConnection | |
| pack-priv JdbcConnection | |
| pack-priv JdbcConnection |
| Access | Constructor and Description |
|---|---|
| pack-priv | MultiHostConnectionProxy()
Initializes a connection wrapper for this MultiHostConnectionProxy instance. |
| pack-priv | MultiHostConnectionProxy(ConnectionUrl
The connection URL. connectionUrl)Constructs a MultiHostConnectionProxy instance for the given connection URL. |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | Returns: true if the given method is allowed on closed connectionsmethod method)Checks if the given method is allowed on closed connections. |
| pack-priv ConnectionImpl | Returns: The new Connection instance.The host info instance. hostInfo)Creates a new physical connection for the given |
| pack-priv void | dealWithInvocationException(InvocationTargetException
The Exception instance to check. e)Deals with InvocationException from proxied objects. |
| pack-priv abstract void | |
| pack-priv abstract void | |
| pack-priv abstract void | |
| public Lock | |
| pack-priv InvocationHandler | Returns: The new InvocationHandler instance.The object instance to be proxied. toProxy)Instantiates a new JdbcInterfaceProxy for the given object. |
| pack-priv JdbcConnection | Returns: The connection object instance that wraps 'this'.Wraps this object with a new multi-host Connection instance. |
| protected JdbcConnection | Returns: Returns this connection's proxy if there is one.Get this connection's parent proxy. |
| protected JdbcConnection | Returns: Returns this connection's proxy if there is one or itself if this is the first one.Get this connection's proxy. |
| pack-priv int | Returns: The number of hosts found in the hosts list.The connection URL that initialized this multi-host connection. connUrl, List<HostInfo> The list of hosts for this multi-host connection. hosts)Initializes the hosts lists and makes a "clean" local copy of the given connection properties so that it can be later used to create standard connections. |
| pack-priv void | invalidateConnection(JdbcConnection
The connection instance to invalidate. conn)Invalidates the specified connection by closing it. |
| pack-priv void | |
| public Object | Returns: method resultproxy object proxy, Method method to invoke method, Object[] method parameters args)Implements java. Proxies method invocation on the java.sql.Connection interface, trapping multi-host specific methods and generic methods. |
| pack-priv abstract Object | Returns: method resultproxy object proxy, Method method to invoke method, Object[] method parameters args)Continuation of the method invocation process, to be implemented within each subclass. |
| pack-priv abstract boolean | Returns: true if current connection is to a source hostChecks if current connection is to a source host. |
| pack-priv abstract void | |
| protected void | propagateProxyDown(JdbcConnection
The top level connection in the multi-host connections chain. proxyConn)Propagates the connection proxy down through the multi-host connections chain. |
| pack-priv Object | Returns: The proxied object or the original one if it does not implement a JDBC interface.The type the object instance to proxy is supposed to be. returnType, Object The object instance to proxy. toProxy)If the given return type is or implements a JDBC interface, proxies the given object so that we can catch SQL errors and fire a connection switch. |
| protected final void | setProxy(JdbcConnection
The top level connection in the multi-host connections chain. proxyConn)Sets this connection's proxy. |
| pack-priv abstract boolean | Returns: true if the given throwable should trigger a connection switchThe Throwable instance to analyze. t)Checks if the given throwable should trigger a connection switch. |
| pack-priv void | syncSessionState(JdbcConnection
The connection where to get state from. source, JdbcConnection The connection where to set state. target)Synchronizes session state between two connections. |
| pack-priv void | syncSessionState(JdbcConnection
The connection where to get state from. source, JdbcConnection The connection where to set state. target, boolean The new read-only status. readOnly)Synchronizes session state between two connections, allowing to override the read-only status. |
| autoReconnect | back to summary |
|---|---|
| pack-priv boolean autoReconnect | |
| closedExplicitly | back to summary |
|---|---|
| pack-priv boolean closedExplicitly | |
| closedReason | back to summary |
|---|---|
| pack-priv String closedReason | |
| connectionUrl | back to summary |
|---|---|
| protected ConnectionUrl connectionUrl | |
| currentConnection | back to summary |
|---|---|
| pack-priv JdbcConnection currentConnection | |
| hostsList | back to summary |
|---|---|
| pack-priv List<HostInfo> hostsList | |
| isClosed | back to summary |
|---|---|
| pack-priv boolean isClosed | |
| lastExceptionDealtWith | back to summary |
|---|---|
| protected Throwable lastExceptionDealtWith | |
| lock | back to summary |
|---|---|
| private final Lock lock | |
| METHOD_ABORT | back to summary |
|---|---|
| private static final String METHOD_ABORT | |
| METHOD_ABORT_INTERNAL | back to summary |
|---|---|
| private static final String METHOD_ABORT_INTERNAL | |
| METHOD_CLOSE | back to summary |
|---|---|
| private static final String METHOD_CLOSE | |
| METHOD_EQUALS | back to summary |
|---|---|
| private static final String METHOD_EQUALS | |
| METHOD_GET_AUTO_COMMIT | back to summary |
|---|---|
| private static final String METHOD_GET_AUTO_COMMIT | |
| METHOD_GET_CATALOG | back to summary |
|---|---|
| private static final String METHOD_GET_CATALOG | |
| METHOD_GET_DATABASE | back to summary |
|---|---|
| private static final String METHOD_GET_DATABASE | |
| METHOD_GET_MULTI_HOST_SAFE_PROXY | back to summary |
|---|---|
| private static final String METHOD_GET_MULTI_HOST_SAFE_PROXY | |
| METHOD_GET_SCHEMA | back to summary |
|---|---|
| private static final String METHOD_GET_SCHEMA | |
| METHOD_GET_SESSION_MAX_ROWS | back to summary |
|---|---|
| private static final String METHOD_GET_SESSION_MAX_ROWS | |
| METHOD_GET_TRANSACTION_ISOLATION | back to summary |
|---|---|
| private static final String METHOD_GET_TRANSACTION_ISOLATION | |
| METHOD_IS_CLOSED | back to summary |
|---|---|
| private static final String METHOD_IS_CLOSED | |
| parentProxyConnection | back to summary |
|---|---|
| pack-priv JdbcConnection parentProxyConnection | |
| thisAsConnection | back to summary |
|---|---|
| pack-priv JdbcConnection thisAsConnection | |
| topProxyConnection | back to summary |
|---|---|
| pack-priv JdbcConnection topProxyConnection | |
| MultiHostConnectionProxy | back to summary |
|---|---|
| pack-priv MultiHostConnectionProxy() throws SQLException Initializes a connection wrapper for this MultiHostConnectionProxy instance.
| |
| MultiHostConnectionProxy | back to summary |
|---|---|
| pack-priv MultiHostConnectionProxy(ConnectionUrl connectionUrl) throws SQLException Constructs a MultiHostConnectionProxy instance for the given connection URL.
| |
| allowedOnClosedConnection | back to summary |
|---|---|
| protected boolean allowedOnClosedConnection(Method method) Checks if the given method is allowed on closed connections.
| |
| createConnectionForHost | back to summary |
|---|---|
| pack-priv ConnectionImpl createConnectionForHost(HostInfo hostInfo) throws SQLException Creates a new physical connection for the given
| |
| dealWithInvocationException | back to summary |
|---|---|
| pack-priv void dealWithInvocationException(InvocationTargetException e) throws SQLException, Throwable, InvocationTargetException Deals with InvocationException from proxied objects.
| |
| doAbort | back to summary |
|---|---|
| pack-priv abstract void doAbort(Executor executor) throws SQLException Executes a abort() invocation;
| |
| doAbortInternal | back to summary |
|---|---|
| pack-priv abstract void doAbortInternal() throws SQLException Executes a abortInternal() invocation;
| |
| doClose | back to summary |
|---|---|
| pack-priv abstract void doClose() throws SQLException Executes a close() invocation;
| |
| getLock | back to summary |
|---|---|
| public Lock getLock() | |
| getNewJdbcInterfaceProxy | back to summary |
|---|---|
| pack-priv InvocationHandler getNewJdbcInterfaceProxy(Object toProxy) Instantiates a new JdbcInterfaceProxy for the given object. Subclasses can override this to return instances of JdbcInterfaceProxy subclasses.
| |
| getNewWrapperForThisAsConnection | back to summary |
|---|---|
| pack-priv JdbcConnection getNewWrapperForThisAsConnection() throws SQLException Wraps this object with a new multi-host Connection instance.
| |
| getParentProxy | back to summary |
|---|---|
| protected JdbcConnection getParentProxy() Get this connection's parent proxy.
| |
| getProxy | back to summary |
|---|---|
| protected JdbcConnection getProxy() Get this connection's proxy. A multi-host connection may not be at top level in the multi-host connections chain. In such case the first connection in the chain is available as a proxy.
| |
| initializeHostsSpecs | back to summary |
|---|---|
| pack-priv int initializeHostsSpecs(ConnectionUrl connUrl, List<HostInfo> hosts) Initializes the hosts lists and makes a "clean" local copy of the given connection properties so that it can be later used to create standard connections.
| |
| invalidateConnection | back to summary |
|---|---|
| pack-priv void invalidateConnection(JdbcConnection conn) throws SQLException Invalidates the specified connection by closing it.
| |
| invalidateCurrentConnection | back to summary |
|---|---|
| pack-priv void invalidateCurrentConnection() throws SQLException Invalidates the current connection.
| |
| invoke | back to summary |
|---|---|
| public Object invoke(Object proxy, Method method, Object[] args) throws Throwable Implements java. Proxies method invocation on the java.sql.Connection interface, trapping multi-host specific methods and generic methods. Subclasses have to override this to complete the method invocation process, deal with exceptions and decide when to switch connection. To avoid unnecessary additional exception handling overriders should consult #canDealWith(Method) before chaining here. | |
| invokeMore | back to summary |
|---|---|
| pack-priv abstract Object invokeMore(Object proxy, Method method, Object[] args) throws Throwable Continuation of the method invocation process, to be implemented within each subclass. | |
| isSourceConnection | back to summary |
|---|---|
| pack-priv abstract boolean isSourceConnection() Checks if current connection is to a source host.
| |
| pickNewConnection | back to summary |
|---|---|
| pack-priv abstract void pickNewConnection() throws SQLException Picks the "best" connection to use from now on. Each subclass needs to implement its connection switch strategy on it.
| |
| propagateProxyDown | back to summary |
|---|---|
| protected void propagateProxyDown(JdbcConnection proxyConn) Propagates the connection proxy down through the multi-host connections chain. This method is intended to be overridden in subclasses that manage more than one active connection at same time.
| |
| proxyIfReturnTypeIsJdbcInterface | back to summary |
|---|---|
| pack-priv Object proxyIfReturnTypeIsJdbcInterface(Class<?> returnType, Object toProxy) If the given return type is or implements a JDBC interface, proxies the given object so that we can catch SQL errors and fire a connection switch. | |
| setProxy | back to summary |
|---|---|
| protected final void setProxy(JdbcConnection proxyConn) Sets this connection's proxy. This proxy should be the first connection in the multi-host connections chain. After setting the connection proxy locally, propagates it through the dependent connections.
| |
| shouldExceptionTriggerConnectionSwitch | back to summary |
|---|---|
| pack-priv abstract boolean shouldExceptionTriggerConnectionSwitch(Throwable t) Checks if the given throwable should trigger a connection switch.
| |
| syncSessionState | back to summary |
|---|---|
| pack-priv void syncSessionState(JdbcConnection source, JdbcConnection target) throws SQLException Synchronizes session state between two connections.
| |
| syncSessionState | back to summary |
|---|---|
| pack-priv void syncSessionState(JdbcConnection source, JdbcConnection target, boolean readOnly) throws SQLException Synchronizes session state between two connections, allowing to override the read-only status.
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public Object | invoke(Object
the proxy instance that the method was invoked on proxy, Method the method, Object[] Method instance corresponding to
the interface method invoked on the proxy instance. The declaring
class of the Method object will be the interface that
the method was declared in, which may be a superinterface of the
proxy interface that the proxy class inherits the method through.an array of objects containing the values of the
arguments passed in the method invocation on the proxy instance,
or args)null if interface method takes no arguments.
Arguments of primitive types are wrapped in instances of the
appropriate primitive wrapper class, such as
java.lang.Integer or java.lang.Boolean.Implements java. Processes a method invocation on a proxy instance and returns the result. |
| invokeOn | back to summary |
|---|---|
| pack-priv Object invokeOn | |
| JdbcInterfaceProxy | back to summary |
|---|---|
| pack-priv JdbcInterfaceProxy(Object toInvokeOn) | |
| invoke | back to summary |
|---|---|
| public Object invoke(Object proxy, Method method, Object[] args) throws Throwable Implements java. Doc from java. Processes a method invocation on a proxy instance and returns the result. This method will be invoked on an invocation handler when a method is invoked on a proxy instance that it is associated with.
| |