Wednesday, May 07, 2008

Maybe this is a bug of JDK 1.6.03

My JDK version is 1.6.03
In the class ThreadPoolExecutor, the counter for completed tasks, long completedTaskCount, with the line 1007:
completedTaskCount += w.completedTasks;
will increase forever if the instance of ThreadPoolExecutor keep alive. It's never reset.

We know that the thread pool usually run as a long time task, so the variable long completedTaskCount is easy to overflow, especially for the heavy load application. We really don't know what will happen if it overflow.

So, this class should be rewritten for the more robust application.