本文整理汇总了Java中com.taobao.tddl.atom.config.TAtomDsConfHandle类的典型用法代码示例。如果您正苦于以下问题:Java TAtomDsConfHandle类的具体用法?Java TAtomDsConfHandle怎么用?Java TAtomDsConfHandle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TAtomDsConfHandle类属于com.taobao.tddl.atom.config包,在下文中一共展示了TAtomDsConfHandle类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doInit
import com.taobao.tddl.atom.config.TAtomDsConfHandle; //导入依赖的package包/类
public void doInit() throws TddlException {
try {
DruidDataSource localDruidDataSource = TAtomDsConfHandle.convertTAtomDsConf2DruidConf(confDO.getIp(),
confDO,
confDO.getDbName());
boolean checkPram = TAtomDsConfHandle.checkLocalTxDataSourceDO(localDruidDataSource);
if (checkPram) {
localDruidDataSource.init();
druidDataSource = localDruidDataSource;
} else {
throw new TddlException(ErrorCode.ERR_CONFIG, "atom config check failed");
}
} catch (Exception e) {
throw new TddlNestableRuntimeException(e);
}
}
示例2: doInit
import com.taobao.tddl.atom.config.TAtomDsConfHandle; //导入依赖的package包/类
@Override
public void doInit() throws TddlException {
LoggerInit.TDDL_DYNAMIC_CONFIG.info("TAtomDataSource start init");
LoggerInit.TDDL_DYNAMIC_CONFIG.info("appName is: " + this.getAppName());
LoggerInit.TDDL_DYNAMIC_CONFIG.info("unitName is: " + this.getUnitName());
LoggerInit.TDDL_DYNAMIC_CONFIG.info("dbGroupKey is: " + this.getDbKey());
String dbName = TAtomConstants.getDbNameStr(this.getUnitName(), this.getAppName(), this.getDbKey());
synchronized (cacheConfHandleMap) {
TAtomDsConfHandle cacheConfHandle = cacheConfHandleMap.get(dbName);
if (null == cacheConfHandle) {
// 初始化config的管理器
this.dsConfHandle.init();
cacheConfHandleMap.put(dbName, dsConfHandle);
logger.info("create new TAtomDsConfHandle dbName : " + dbName);
} else {
dsConfHandle = cacheConfHandle;
logger.info("use the cache TAtomDsConfHandle dbName : " + dbName);
}
}
}
示例3: init
import com.taobao.tddl.atom.config.TAtomDsConfHandle; //导入依赖的package包/类
public void init() throws Exception {
if (init) {
throw new AtomAlreadyInitException("[AlreadyInit] double call Init !");
}
DruidDataSource localDruidDataSource = TAtomDsConfHandle.convertTAtomDsConf2DruidConf(confDO.getIp(),
confDO,
confDO.getDbName());
boolean checkPram = TAtomDsConfHandle.checkLocalTxDataSourceDO(localDruidDataSource);
if (checkPram) {
localDruidDataSource.init();
// druidDataSource =
// TaobaoDataSourceFactory.createLocalTxDataSource(localDruidDataSource);
druidDataSource = localDruidDataSource;
init = true;
} else {
throw new Exception("Init DataSource Error Pleace Check!");
}
}
示例4: cleanAllDataSource
import com.taobao.tddl.atom.config.TAtomDsConfHandle; //导入依赖的package包/类
/**
* 清除掉所有数据源
*/
public static void cleanAllDataSource() {
synchronized (cacheConfHandleMap) {
for (TAtomDsConfHandle handles : cacheConfHandleMap.values()) {
try {
handles.destroyDataSource();
} catch (Exception e) {
logger.info("destory TAtomDsConfHandle failed!", e);
continue;
}
}
cacheConfHandleMap.clear();
}
}
示例5: init
import com.taobao.tddl.atom.config.TAtomDsConfHandle; //导入依赖的package包/类
public void init() throws Exception {
String dbName = TAtomConstants.getDbNameStr(this.getUnitName(), this.getAppName(), this.getDbKey());
synchronized (cacheConfHandleMap) {
TAtomDsConfHandle cacheConfHandle = cacheConfHandleMap.get(dbName);
if (null == cacheConfHandle) {
// 初始化config的管理器
this.dsConfHandle.init();
cacheConfHandleMap.put(dbName, dsConfHandle);
logger.info("create new TAtomDsConfHandle dbName : " + dbName);
} else {
dsConfHandle = cacheConfHandle;
logger.info("use the cache TAtomDsConfHandle dbName : " + dbName);
}
}
}
示例6: cleanAllDataSource
import com.taobao.tddl.atom.config.TAtomDsConfHandle; //导入依赖的package包/类
/**
* 清除掉所有数据源
*/
public static void cleanAllDataSource() {
synchronized (cacheConfHandleMap) {
for (TAtomDsConfHandle handles : cacheConfHandleMap.values()) {
try {
handles.destroyDataSource();
} catch (Exception e) {
e.printStackTrace();
continue;
}
}
cacheConfHandleMap.clear();
}
}