Search in sources :

Example 1 with ValidatingConnectionValidatorHolder

use of com.ctrip.platform.dal.dao.datasource.cluster.strategy.ValidatingConnectionValidatorHolder in project dal by ctripcorp.

the class MultiHostDataSource method prepareRouteStrategy.

protected RouteStrategy prepareRouteStrategy() {
    RouteStrategy strategy = this.clusterProperties.generate();
    strategy.init(shardMeta.configuredHosts(), clusterProperties.routeStrategyProperties());
    if (strategy instanceof ConnectionFactoryAware) {
        ((ConnectionFactoryAware) strategy).setConnectionFactory(this.connFactory);
    }
    if (strategy instanceof HostConnectionValidatorHolder) {
        this.connValidator = ((HostConnectionValidatorHolder) strategy).getHostConnectionValidator();
    }
    if (strategy instanceof ValidatingConnectionValidatorHolder) {
        this.validatingConnValidator = ((ValidatingConnectionValidatorHolder) strategy).getValidatingConnectionValidator();
    }
    return strategy;
}
Also used : ConnectionFactoryAware(com.ctrip.platform.dal.dao.datasource.cluster.strategy.ConnectionFactoryAware) ValidatingConnectionValidatorHolder(com.ctrip.platform.dal.dao.datasource.cluster.strategy.ValidatingConnectionValidatorHolder) RouteStrategy(com.ctrip.platform.dal.dao.datasource.cluster.strategy.RouteStrategy) HostConnectionValidatorHolder(com.ctrip.platform.dal.dao.datasource.cluster.strategy.HostConnectionValidatorHolder)

Aggregations

ConnectionFactoryAware (com.ctrip.platform.dal.dao.datasource.cluster.strategy.ConnectionFactoryAware)1 HostConnectionValidatorHolder (com.ctrip.platform.dal.dao.datasource.cluster.strategy.HostConnectionValidatorHolder)1 RouteStrategy (com.ctrip.platform.dal.dao.datasource.cluster.strategy.RouteStrategy)1 ValidatingConnectionValidatorHolder (com.ctrip.platform.dal.dao.datasource.cluster.strategy.ValidatingConnectionValidatorHolder)1