Package com.mysql.cj.jdbc.ha
Class StandardLoadBalanceExceptionChecker
java.lang.Object
com.mysql.cj.jdbc.ha.StandardLoadBalanceExceptionChecker
- All Implemented Interfaces:
LoadBalanceExceptionChecker
- Direct Known Subclasses:
NdbLoadBalanceExceptionChecker
public class StandardLoadBalanceExceptionChecker extends java.lang.Object implements LoadBalanceExceptionChecker
-
Constructor Summary
Constructors Constructor Description StandardLoadBalanceExceptionChecker()
-
Method Summary
Modifier and Type Method Description void
destroy()
Called by the driver when this extension should release any resources it is holding and cleanup internally before the connection is closed.void
init(java.util.Properties props)
Called once per connection that wants to use the extension The properties are the same ones passed in in the URL or arguments to Driver.connect() or DriverManager.getConnection().boolean
shouldExceptionTriggerFailover(java.lang.Throwable ex)
Invoked to determine whether or a given SQLException should trigger a failover in a load-balanced deployment.
-
Constructor Details
-
StandardLoadBalanceExceptionChecker
public StandardLoadBalanceExceptionChecker()
-
-
Method Details
-
shouldExceptionTriggerFailover
public boolean shouldExceptionTriggerFailover(java.lang.Throwable ex)Description copied from interface:LoadBalanceExceptionChecker
Invoked to determine whether or a given SQLException should trigger a failover in a load-balanced deployment. The driver will not pass in a Connection instance when calling init(), but it will pass in the Properties, otherwise it acts like a normal Extension. One instance of a handler *per* JDBC connection instance will be created. If you need singleton-like behavior, you're on your own to provide it.- Specified by:
shouldExceptionTriggerFailover
in interfaceLoadBalanceExceptionChecker
- Parameters:
ex
- exception- Returns:
- true if the exception should trigger failover.
-
destroy
public void destroy()Description copied from interface:LoadBalanceExceptionChecker
Called by the driver when this extension should release any resources it is holding and cleanup internally before the connection is closed.- Specified by:
destroy
in interfaceLoadBalanceExceptionChecker
-
init
public void init(java.util.Properties props)Description copied from interface:LoadBalanceExceptionChecker
Called once per connection that wants to use the extension The properties are the same ones passed in in the URL or arguments to Driver.connect() or DriverManager.getConnection().- Specified by:
init
in interfaceLoadBalanceExceptionChecker
- Parameters:
props
- configuration values as passed to the connection. Note that in order to support javax.sql.DataSources, configuration properties specific to an interceptor must be passed via setURL() on the DataSource. Extension properties are not exposed via accessor/mutator methods on DataSources.
-