| Modifier and Type | Class and Description |
|---|---|
| private static class | LoadBalancedConnectionProxy.
A LoadBalancedConnection proxy that provides null-functionality. |
| Modifier and Type | Field and Description |
|---|---|
| private BalanceStrategy | |
| private ConnectionGroup | |
| private long | |
| private Map | |
| private LoadBalanceExceptionChecker | |
| private static Map | |
| private int | |
| private int | |
| private Map | |
| private Set | |
| private static Class | |
| private boolean | |
| protected Map | |
| private static final Lock | |
| private static LoadBalancedConnection | |
| private long[] | |
| private int | |
| private long | |
| private long | |
| private long |
| Access | Constructor and Description |
|---|---|
| public | LoadBalancedConnectionProxy(ConnectionUrl
The connection URL containing the hosts to load balance. connectionUrl)Creates a proxy for java.sql.Connection that routes requests between the hosts in the connection URL. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public void | addToGlobalBlocklist(String
The host to be blocklisted. host, long The blocklist timeout for this entry. timeout)Adds a host to the blocklist with the given timeout. |
| public void | |
| private void | |
| public ConnectionImpl | Returns: The new Connection instance.The host info instance. hostInfo)Overrides com. Creates a new physical connection for the given |
| public ConnectionImpl | Returns: The new Connection instance.The host:port pair identifying the host to connect to. hostPortPair)Creates a new physical connection for the given host:port info. |
| public static LoadBalancedConnection | Returns: ALoadBalancedConnection proxy.The connection URL containing the hosts in a load-balance setup. connectionUrl)Static factory to create |
| pack-priv void | doAbort(Executor
executor executor)Implements abstract com. Aborts all live connections, using the provided Executor. |
| pack-priv void | doAbortInternal()
Implements abstract com. Aborts all live connections |
| pack-priv void | doClose()
Implements abstract com. Closes all live connections. |
| public void | |
| public long | |
| public long | |
| public String | |
| public long | |
| public Map | Returns: A local hosts blocklist.Returns a local hosts blocklist, while cleaning up expired records from the global blocklist, or a blocklist with the hosts to be removed. |
| pack-priv JdbcConnection | Returns: The connection object instance that wraps 'this'.Overrides com. Wraps this object with a new load balanced Connection instance. |
| pack-priv static LoadBalancedConnection | |
| public long | |
| public long | |
| public boolean | |
| pack-priv void | invalidateConnection(JdbcConnection
connection conn)Overrides com. Closes specified connection and removes it from required mappings. |
| pack-priv Object | invokeMore(Object
proxy object proxy, Method method to invoke method, Object[] method parameters args)Implements abstract com. Proxies method invocation on the java.sql.Connection interface, trapping "close", "isClosed" and "commit/rollback" to switch connections for load balancing. |
| public boolean | Returns: true if host blocklist management was enabledChecks if host blocklist management was enabled. |
| pack-priv boolean | isSourceConnection()
Implements abstract com. Always returns 'true' as there are no "sources" and "replicas" in this type of connection. |
| public void | pickNewConnection()
Implements abstract com. Picks the "best" connection to use for the next transaction based on the BalanceStrategy in use. |
| protected void | propagateProxyDown(JdbcConnection
The top level connection in the multi-host connections chain. proxyConn)Overrides com. Propagates the connection proxy down through all live connections. |
| public void | removeFromGlobalBlocklist(String
The host to be removed from the blocklist. host)Removes a host from the blocklist. |
| public void | |
| public void | removeHostWhenNotInUse(String
The host to be removed. hostPortPair)Removes a host from the host list, allowing it some time to be released gracefully if needed. |
| pack-priv boolean | Returns: true if the given exception should trigger a connection fail-overThe Exception instance to check. t)Implements abstract com. Consults the registered LoadBalanceExceptionChecker if the given exception should trigger a connection fail-over. |
| public boolean | |
| 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)Overrides com. Synchronizes session state between two connections, allowing to override the read-only status. |
| balancer | back to summary |
|---|---|
| private BalanceStrategy balancer | |
| connectionGroup | back to summary |
|---|---|
| private ConnectionGroup connectionGroup | |
| connectionGroupProxyID | back to summary |
|---|---|
| private long connectionGroupProxyID | |
| connectionsToHostsMap | back to summary |
|---|---|
| private Map<ConnectionImpl, String> connectionsToHostsMap | |
| exceptionChecker | back to summary |
|---|---|
| private LoadBalanceExceptionChecker exceptionChecker | |
| globalBlocklist | back to summary |
|---|---|
| private static Map<String, Long> globalBlocklist | |
| globalBlocklistTimeout | back to summary |
|---|---|
| private int globalBlocklistTimeout | |
| hostRemovalGracePeriod | back to summary |
|---|---|
| private int hostRemovalGracePeriod | |
| hostsToListIndexMap | back to summary |
|---|---|
| private Map<String, Integer> hostsToListIndexMap | |
| hostsToRemove | back to summary |
|---|---|
| private Set<String> hostsToRemove | |
| INTERFACES_TO_PROXY | back to summary |
|---|---|
| private static Class<?>[] INTERFACES_TO_PROXY | |
| inTransaction | back to summary |
|---|---|
| private boolean inTransaction | |
| liveConnections | back to summary |
|---|---|
| protected Map<String, ConnectionImpl> liveConnections | |
| LOCK | back to summary |
|---|---|
| private static final Lock LOCK | |
| nullLBConnectionInstance | back to summary |
|---|---|
| private static LoadBalancedConnection nullLBConnectionInstance | |
| responseTimes | back to summary |
|---|---|
| private long[] responseTimes | |
| retriesAllDown | back to summary |
|---|---|
| private int retriesAllDown | |
| totalPhysicalConnections | back to summary |
|---|---|
| private long totalPhysicalConnections | |
| transactionCount | back to summary |
|---|---|
| private long transactionCount | |
| transactionStartTime | back to summary |
|---|---|
| private long transactionStartTime | |
| LoadBalancedConnectionProxy | back to summary |
|---|---|
| public LoadBalancedConnectionProxy(ConnectionUrl connectionUrl) throws SQLException Creates a proxy for java.sql.Connection that routes requests between the hosts in the connection URL.
| |
| addHost | back to summary |
|---|---|
| public boolean addHost(String hostPortPair) Adds a host to the hosts list.
| |
| addToGlobalBlocklist | back to summary |
|---|---|
| public void addToGlobalBlocklist(String host, long timeout) Adds a host to the blocklist with the given timeout.
| |
| addToGlobalBlocklist | back to summary |
|---|---|
| public void addToGlobalBlocklist(String host) Adds a host to the blocklist.
| |
| closeAllConnections | back to summary |
|---|---|
| private void closeAllConnections() Closes all live connections. | |
| createConnectionForHost | back to summary |
|---|---|
| public ConnectionImpl createConnectionForHost(HostInfo hostInfo) throws SQLException Overrides com. Creates a new physical connection for the given
| |
| createConnectionForHost | back to summary |
|---|---|
| public ConnectionImpl createConnectionForHost(String hostPortPair) throws SQLException Creates a new physical connection for the given host:port info. If the this connection's connection URL knows about this host:port then its host info is used, otherwise a new host info based on current connection URL defaults is spawned.
| |
| createProxyInstance | back to summary |
|---|---|
| public static LoadBalancedConnection createProxyInstance(ConnectionUrl connectionUrl) throws SQLException Static factory to create
| |
| doAbort | back to summary |
|---|---|
| pack-priv void doAbort(Executor executor) Implements abstract com. Aborts all live connections, using the provided Executor.
| |
| doAbortInternal | back to summary |
|---|---|
| pack-priv void doAbortInternal() Implements abstract com. Aborts all live connections
| |
| doClose | back to summary |
|---|---|
| pack-priv void doClose() Implements abstract com. Closes all live connections.
| |
| doPing | back to summary |
|---|---|
| public void doPing() throws SQLException Implements com. Pings live connections.
| |
| getActivePhysicalConnectionCount | back to summary |
|---|---|
| public long getActivePhysicalConnectionCount() | |
| getConnectionGroupProxyID | back to summary |
|---|---|
| public long getConnectionGroupProxyID() | |
| getCurrentActiveHost | back to summary |
|---|---|
| public String getCurrentActiveHost() | |
| getCurrentTransactionDuration | back to summary |
|---|---|
| public long getCurrentTransactionDuration() | |
| getGlobalBlocklist | back to summary |
|---|---|
| public Map Returns a local hosts blocklist, while cleaning up expired records from the global blocklist, or a blocklist with the hosts to be removed. | |
| getNewWrapperForThisAsConnection | back to summary |
|---|---|
| pack-priv JdbcConnection getNewWrapperForThisAsConnection() throws SQLException Overrides com. Wraps this object with a new load balanced Connection instance.
| |
| getNullLoadBalancedConnectionInstance | back to summary |
|---|---|
| pack-priv static LoadBalancedConnection getNullLoadBalancedConnectionInstance() | |
| getTotalPhysicalConnectionCount | back to summary |
|---|---|
| public long getTotalPhysicalConnectionCount() | |
| getTransactionCount | back to summary |
|---|---|
| public long getTransactionCount() | |
| inTransaction | back to summary |
|---|---|
| public boolean inTransaction() | |
| invalidateConnection | back to summary |
|---|---|
| pack-priv void invalidateConnection(JdbcConnection conn) throws SQLException Overrides com. Closes specified connection and removes it from required mappings.
| |
| invokeMore | back to summary |
|---|---|
| pack-priv Object invokeMore(Object proxy, Method method, Object[] args) throws Throwable Implements abstract com. Proxies method invocation on the java.sql.Connection interface, trapping "close", "isClosed" and "commit/rollback" to switch connections for load balancing. This is the continuation of MultiHostConnectionProxy#invoke(Object, Method, Object[]).
| |
| isGlobalBlocklistEnabled | back to summary |
|---|---|
| public boolean isGlobalBlocklistEnabled() Checks if host blocklist management was enabled.
| |
| isSourceConnection | back to summary |
|---|---|
| pack-priv boolean isSourceConnection() Implements abstract com. Always returns 'true' as there are no "sources" and "replicas" in this type of connection.
| |
| pickNewConnection | back to summary |
|---|---|
| public void pickNewConnection() throws SQLException Implements abstract com. Picks the "best" connection to use for the next transaction based on the BalanceStrategy in use.
| |
| propagateProxyDown | back to summary |
|---|---|
| protected void propagateProxyDown(JdbcConnection proxyConn) Overrides com. Propagates the connection proxy down through all live connections.
| |
| removeFromGlobalBlocklist | back to summary |
|---|---|
| public void removeFromGlobalBlocklist(String host) Removes a host from the blocklist.
| |
| removeHost | back to summary |
|---|---|
| public void removeHost(String hostPortPair) throws SQLException Removes a host from the host list.
| |
| removeHostWhenNotInUse | back to summary |
|---|---|
| public void removeHostWhenNotInUse(String hostPortPair) throws SQLException Removes a host from the host list, allowing it some time to be released gracefully if needed.
| |
| shouldExceptionTriggerConnectionSwitch | back to summary |
|---|---|
| pack-priv boolean shouldExceptionTriggerConnectionSwitch(Throwable t) Implements abstract com. Consults the registered LoadBalanceExceptionChecker if the given exception should trigger a connection fail-over. | |
| shouldExceptionTriggerFailover | back to summary |
|---|---|
| public boolean shouldExceptionTriggerFailover(Throwable t)
Deprecated
| |
| syncSessionState | back to summary |
|---|---|
| pack-priv void syncSessionState(JdbcConnection source, JdbcConnection target, boolean readOnly) throws SQLException Overrides com. Doc from com. Synchronizes session state between two connections, allowing to override the read-only status.
| |
| Access | Constructor and Description |
|---|---|
| public |
| 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. |
| NullLoadBalancedConnectionProxy | back to summary |
|---|---|
| public NullLoadBalancedConnectionProxy() | |
| 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.
| |