Search in sources :

Example 1 with DalConfigLoader

use of com.ctrip.platform.dal.dao.configure.DalConfigLoader in project dal by ctripcorp.

the class DalClientFactory method internalInitClientFactory.

private static void internalInitClientFactory(String path) throws Exception {
    if (configureRef.get() != null) {
        logger.warn("Dal Java Client Factory is already initialized.");
        return;
    }
    synchronized (DalClientFactory.class) {
        if (configureRef.get() != null) {
            return;
        }
        DalConfigure config = null;
        if (path == null) {
            DalConfigLoader loader = ServiceLoaderHelper.getInstance(DalConfigLoader.class);
            if (loader == null)
                config = DalConfigureFactory.load();
            else
                config = loader.load();
            logger.info("Successfully initialized Dal Java Client Factory");
        } else {
            config = DalConfigureFactory.load(path);
            logger.info("Successfully initialized Dal Java Client Factory with " + path);
        }
        DalWatcher.init();
        DalRequestExecutor.init(config.getFacory().getProperty(DalRequestExecutor.MAX_POOL_SIZE));
        DalStatusManager.initialize(config);
        configureRef.set(config);
    }
}
Also used : DalConfigure(com.ctrip.platform.dal.dao.configure.DalConfigure) DalConfigLoader(com.ctrip.platform.dal.dao.configure.DalConfigLoader)

Aggregations

DalConfigLoader (com.ctrip.platform.dal.dao.configure.DalConfigLoader)1 DalConfigure (com.ctrip.platform.dal.dao.configure.DalConfigure)1