use of com.ctrip.platform.dal.dao.datasource.cluster.strategy.ConnectionFactoryAware 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;
}
Aggregations