Mercurial > hg > Database > Christie
diff src/main/java/christie/codegear/StartCodeGear.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 diff
--- a/src/main/java/christie/codegear/StartCodeGear.java Thu Dec 14 20:46:18 2017 +0900 +++ b/src/main/java/christie/codegear/StartCodeGear.java Wed Dec 27 00:06:50 2017 +0900 @@ -1,20 +1,22 @@ package christie.codegear; import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public abstract class StartCodeGear implements Runnable { - static HashMap<String, CodeGearManager> cgms = new HashMap<String, CodeGearManager>(); - static LinkedBlockingQueue<Runnable> taskQueue = new LinkedBlockingQueue<Runnable>(); - static ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), // initial number of threads + ConcurrentHashMap<String, CodeGearManager> cgms = new ConcurrentHashMap<>(); + LinkedBlockingQueue<Runnable> taskQueue = new LinkedBlockingQueue<Runnable>(); + ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), // initial number of threads Runtime.getRuntime().availableProcessors(), Integer.MAX_VALUE, // keepAliveTime TimeUnit.SECONDS, taskQueue); - public static CodeGearManager createCGM(String name){ + + public CodeGearManager createCGM(String name){ CodeGearManager cgm = new CodeGearManager(threadPoolExecutor); cgms.put(name, cgm); return cgm;