package cd.casic.plugin;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class PluginClassLoaderCache {
    private static final Map<String, ClassLoader> loaderMap = Collections.synchronizedMap(new HashMap<>());
    public static void put(String pluginId, ClassLoader loader) {
        loaderMap.putIfAbsent(pluginId, loader);
    }

    public static ClassLoader getPlugin(String pluginId) {
        return loaderMap.get(pluginId);
    }

    public static void remove(String pluginId) {
        loaderMap.remove(pluginId);
    }

    public static Map<String, ClassLoader> getAllPlugin() {
        return loaderMap;
    }
}
