开发者

ThreadPool don't run submitted tasks

I have strange problem with java ThreadPool

I'm define executorService as follow:

ExecutorService executorService = Executors.newFixedThreadPool(5)

and later submit 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开发者_Go百科();
   }
}

outExecuteTasks log some debug info including task count:

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

after running some time (after exected 50-100 task according to thread pool completedTask counter) i'm see strange behavior - submitted tasks appends to pool queue but not executed at all! ThreadPool reported active tasks = 0, task queue size big and counting, and none of tasks executed according to log.

Has someone some problem?


Ok, i'm collect enough statistics to say: this is problem of concrete linux kernel

[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

of redhat box. This not reproduced even on 2.4.31 and hihger.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜