comparison 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
comparison
equal deleted inserted replaced
195:a0be7c83fff8 196:ad49723367c2
5 import java.util.concurrent.ThreadPoolExecutor; 5 import java.util.concurrent.ThreadPoolExecutor;
6 import java.util.concurrent.TimeUnit; 6 import java.util.concurrent.TimeUnit;
7 7
8 public abstract class StartCodeGear extends CodeGear{ 8 public abstract class StartCodeGear extends CodeGear{
9 static ConcurrentHashMap<Integer, CodeGearManager> cgmList = new ConcurrentHashMap<>(); 9 static ConcurrentHashMap<Integer, CodeGearManager> cgmList = new ConcurrentHashMap<>();
10 static LinkedBlockingQueue<Runnable> taskQueue = new LinkedBlockingQueue<Runnable>(); 10 //static LinkedBlockingQueue<Runnable> taskQueue = new LinkedBlockingQueue<Runnable>();
11 static ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), // initial number of threads 11 /*static ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), // initial number of threads
12 Runtime.getRuntime().availableProcessors(), 12 Runtime.getRuntime().availableProcessors(),
13 Integer.MAX_VALUE, // keepAliveTime 13 Integer.MAX_VALUE, // keepAliveTime
14 TimeUnit.SECONDS, 14 TimeUnit.SECONDS,
15 taskQueue); 15 taskQueue);*/
16 static ThreadPoolExecutor threadPoolExecutor = PriorityThreadPoolExecutors.createThreadPool(Runtime.getRuntime().availableProcessors(), Integer.MAX_VALUE);
16 static int cgmCount = 1; 17 static int cgmCount = 1;
17 18
18 public StartCodeGear(CodeGearManager cgm){ 19 public StartCodeGear(CodeGearManager cgm){
19 cgm.setup(this); 20 cgm.setup(this);
20 } 21 }