Mercurial > hg > Database > Christie
view src/main/java/christie/codegear/StartCodeGear.java @ 208:ef5aad739292
update priority
author | akahori |
---|---|
date | Sun, 10 Mar 2019 16:25:52 +0900 |
parents | ad49723367c2 |
children |
line wrap: on
line source
package christie.codegear; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public abstract class StartCodeGear extends CodeGear{ static ConcurrentHashMap<Integer, CodeGearManager> cgmList = new ConcurrentHashMap<>(); /*static LinkedBlockingQueue<Runnable> taskQueue = new LinkedBlockingQueue<Runnable>(); static ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), // initial number of threads Runtime.getRuntime().availableProcessors(), Integer.MAX_VALUE, // keepAliveTime TimeUnit.SECONDS, taskQueue);*/ static ThreadPoolExecutor threadPoolExecutor = PriorityThreadPoolExecutors.createThreadPool(Runtime.getRuntime().availableProcessors(), Integer.MAX_VALUE); static int cgmCount = 1; public StartCodeGear(CodeGearManager cgm){ cgm.setup(this); } public static CodeGearManager createCGM(int localPort){ CodeGearManager cgm = new CodeGearManager(cgmCount, threadPoolExecutor, cgmList, localPort); cgmList.put(cgmCount++, cgm); return cgm; } public static CodeGearManager getCGM(String name){ return cgmList.get(name); } @Override protected void run(CodeGearManager cgm) {} }