Mercurial > hg > Database > Christie
view src/main/java/christie/codegear/StartCodeGear.java @ 196:ad49723367c2
add priority
author | akahori |
---|---|
date | Sat, 09 Mar 2019 14:03:06 +0900 |
parents | be58bfe90766 |
children | ef5aad739292 |
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) {} }