Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ThreadLocal에 저장되어 있는 DataSourceType을 가져온다.
import kr.sidnancy.common.type.DataSourceType;
/**
* @author sidnancy81
*/
public class ContextHolder {
private static final ThreadLocal<DataSourceType> contextHolder = new ThreadLocal<DataSourceType>();
public static void setDataSourceType(DataSourceType dataSourceType){
contextHolder.set(dataSourceType);
}
public static DataSourceType getDataSourceType(){
return contextHolder.get();
}
public static void clearDataSourceType(){
contextHolder.remove();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment