package com.gxx.record.core;
/**
*
* - Title:
* -
* none
*
* - Description:使用ThreadLocal设置和获取当前线程的数据源KEY
* -
*
none
*
*
*
* @author Gxx
* @version 1.0, 2016年1月12日
* @since record
*
*/
public class DatabaseContextHolder {
/**
* ThreadLocal
*/
private static final ThreadLocal contextHolder = new ThreadLocal();
/**
* 设置数据源KEY
* @param customerType
*/
public static void setCustomerType(String customerType) {
contextHolder.set(customerType);
}
/**
* 获取数据源KEY
* @return
*/
public static String getCustomerType() {
return contextHolder.get();
}
/**
* 清空数据源KEY
*/
public static void clearCustomerType() {
contextHolder.remove();
}
}