package com.younike.common.atomikos;


import com.baomidou.dynamic.datasource.AbstractRoutingDataSource;
import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;

import javax.sql.DataSource;

public class DataSourceSwitcher extends AbstractRoutingDataSource {


    private static final ThreadLocal<String> threadLocal = new ThreadLocal<>();

    public static void setDataSource(String name) {
        threadLocal.set(name);
    }

    public static void setToDefaultSource() {
        threadLocal.remove();
    }


    @Override
    protected DataSource determineDataSource() {
        return null;
    }
}
