use of com.ctrip.platform.dal.dao.datasource.log.ClusterDbSqlContext in project dal by ctripcorp.
the class ClusterDataSource method createSqlContext.
@Override
protected SqlContext createSqlContext() {
SqlContext context = id.createSqlContext();
if (context instanceof ClusterDbSqlContext) {
((ClusterDbSqlContext) context).populateShard(getShardIndex());
((ClusterDbSqlContext) context).populateRole(DatabaseRole.MASTER);
}
return context;
}
use of com.ctrip.platform.dal.dao.datasource.log.ClusterDbSqlContext in project dal by ctripcorp.
the class TraceableClusterDataSourceIdentity method createSqlContext.
@Override
public SqlContext createSqlContext() {
Cluster cluster = getDatabase().getCluster();
ClusterDbSqlContext context = new ClusterDbSqlContext(cluster, getShardIndex(), getDatabaseRole());
if (cluster != null && cluster.getLocalizationConfig() != null)
context.populateDbZone(cluster.getLocalizationConfig().getZoneId());
return context;
}
Aggregations