ThreadPool Does Not Run Tasks


I have a strange problem with java ThreadPool

I define executorService as follows:

ExecutorService executorService = Executors.newFixedThreadPool(5) 

and later send tasks:

 while (!manager.stop()) { File file = getFile(); if (file != null) { String name = file.getName(); log.debug("add new task with name {}", name); outExecutorInfo(); Future<?> task = executorService.submit(getTask(file)); outTaskInfo(task); executeTasks.put(name, task); outExecuteTasks(); } } 

outExecuteTasks logs some debugging information, including the number of tasks:

 log.debug("activeCount={}, completedTaskCount={}, taskCount={}. poolSize={}", new Object[] { activeCount, completedTaskCount,taskCount, poolSize }); 

after completing some time (after completing task 50-100 in accordance with the pool of filled threads), I see strange behavior - sent tasks are added to the pool queue, but are not executed at all! ThreadPool reported active tasks = 0, a large task queue and count, and none of the tasks were performed in accordance with the log.
Anyone have a problem?

+4
source share
1 answer

Ok, I am collecting enough statistics to say: this is a particular Linux kernel problem

 [ root@mag ]$ uname -a Linux ns.mag 2.4.20-8smp #1 SMP Thu Mar 13 17:45:54 EST 2003 i686 i686 i386 GNU/Linux 

windows redhat. It did not play even on 2.4.31 and hihger.

+2
source

Source: https://habr.com/ru/post/1336909/


All Articles