view src/main/java/christie/codegear/CodeGearManager.java @ 6:3dcfe63d6394

set type to DataGear by Annotation
author Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
date Wed, 27 Dec 2017 00:06:50 +0900
parents 5be6647b87d2
children 21372a589bd3
line wrap: on
line source

package christie.codegear;

import christie.datagear.DataGearManager;
import christie.datagear.LocalDataGearManager;
import christie.datagear.RemoteDataGearManager;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * Created by e125769 on 12/7/17.
 * CodeGearの実行
 */
public class CodeGearManager{
    private ConcurrentHashMap<String, DataGearManager>  dataGearManagers = new ConcurrentHashMap<String, DataGearManager>();
    private ThreadPoolExecutor codeGearExecutor;

    public CodeGearManager(ThreadPoolExecutor exe) {
        dataGearManagers.put("local", new LocalDataGearManager());
        codeGearExecutor = exe;
    }

    public DataGearManager getDGM(){
        return dataGearManagers.get("local");
    }

    public DataGearManager getDGM(String dest){
        return dataGearManagers.get(dest);
    }

    public void createRemoteDataGeareManager(String dist){
        dataGearManagers.put(dist, new RemoteDataGearManager());
    }

    public void submit(CodeGear cg){
        codeGearExecutor.execute(cg);
    }

}