package com.ruoyi.system.test;

import javax.sql.DataSource;

import java.util.concurrent.ConcurrentHashMap;

public class DataSourceManager {
    // 使用 ConcurrentHashMap 存储数据源
    private final ConcurrentHashMap<String, DataSource> dataSourceMap;

    public DataSourceManager() {
        dataSourceMap = new ConcurrentHashMap<>();
    }

    // 添加数据源
    public void addDataSource(String name, DataSource dataSource) {
        dataSourceMap.put(name, dataSource);
    }

    // 获取数据源
    public DataSource getDataSource(String name) {
        return dataSourceMap.get(name);
    }
}