lodsve.mongodb.connection.MongoDataSourceHolder Maven / Gradle / Ivy
package lodsve.mongodb.connection;
/**
* 多数据源保存选择的数据源.
*
* @author sunhao([email protected])
* @version 1.0 2017/12/14 下午6:03
*/
public class MongoDataSourceHolder {
private static final ThreadLocal DATAS_SOURCE = new ThreadLocal<>();
public static String get() {
return DATAS_SOURCE.get();
}
static void set(String dataSource) {
DATAS_SOURCE.set(dataSource);
}
static void clear() {
DATAS_SOURCE.remove();
}
}