Search in sources :

Example 1 with DruidMycatRouteStrategy

use of io.mycat.route.impl.DruidMycatRouteStrategy in project Mycat_plus by coderczp.

the class RouteStrategyFactory method init.

public static void init() {
    SystemConfig config = MycatServer.getInstance().getConfig().getSystem();
    String defaultSqlParser = config.getDefaultSqlParser();
    defaultSqlParser = defaultSqlParser == null ? "" : defaultSqlParser;
    // 修改为ConcurrentHashMap,避免并发问题
    strategyMap.putIfAbsent("druidparser", new DruidMycatRouteStrategy());
    defaultStrategy = strategyMap.get(defaultSqlParser);
    if (defaultStrategy == null) {
        defaultStrategy = strategyMap.get("druidparser");
        defaultSqlParser = "druidparser";
    }
    config.setDefaultSqlParser(defaultSqlParser);
    isInit = true;
}
Also used : SystemConfig(io.mycat.config.model.SystemConfig) DruidMycatRouteStrategy(io.mycat.route.impl.DruidMycatRouteStrategy)

Example 2 with DruidMycatRouteStrategy

use of io.mycat.route.impl.DruidMycatRouteStrategy in project Mycat-Server by MyCATApache.

the class RouteStrategyFactory method init.

public static void init() {
    SystemConfig config = MycatServer.getInstance().getConfig().getSystem();
    String defaultSqlParser = config.getDefaultSqlParser();
    defaultSqlParser = defaultSqlParser == null ? "" : defaultSqlParser;
    // 修改为ConcurrentHashMap,避免并发问题
    strategyMap.putIfAbsent("druidparser", new DruidMycatRouteStrategy());
    defaultStrategy = strategyMap.get(defaultSqlParser);
    if (defaultStrategy == null) {
        defaultStrategy = strategyMap.get("druidparser");
        defaultSqlParser = "druidparser";
    }
    config.setDefaultSqlParser(defaultSqlParser);
    isInit = true;
}
Also used : SystemConfig(io.mycat.config.model.SystemConfig) DruidMycatRouteStrategy(io.mycat.route.impl.DruidMycatRouteStrategy)

Aggregations

SystemConfig (io.mycat.config.model.SystemConfig)2 DruidMycatRouteStrategy (io.mycat.route.impl.DruidMycatRouteStrategy)2