Authored by all4you

update

... ... @@ -16,11 +16,13 @@ public class RunnableQueueFactory {
private static final Logger LOGGER = LoggerFactory.getLogger(RunnableQueueFactory.class);
private static final int MAX_QUEUE_SIZE = 100;
private static final int QUEUE_THREADS_SIZE = 10;
private static final int MAX_QUEUE_CAPACITY = 100;
private Map<String,BlockingQueue<Runnable>> queueMap = new ConcurrentHashMap<>();
private ExecutorService executorService = Executors.newFixedThreadPool(10);
private ExecutorService executorService = Executors.newFixedThreadPool(QUEUE_THREADS_SIZE);
/**
* add a task
... ... @@ -30,7 +32,7 @@ public class RunnableQueueFactory {
public void addTask(String type, Runnable task){
BlockingQueue<Runnable> queue = queueMap.get(type);
if(queue==null){
queue = new ArrayBlockingQueue<>(MAX_QUEUE_SIZE);
queue = new ArrayBlockingQueue<>(MAX_QUEUE_CAPACITY);
putTask(queue,type,task);
queueMap.putIfAbsent(type,queue);
initQueue(type);
... ...