This discussion is archived
2 Replies Latest reply: Aug 13, 2012 1:25 AM by 950535 RSS

ThreadPoolExecutor behaviour change in Java 7

950535 Newbie
Currently Being Moderated
The behaviour of ThreadPoolExecutor has changed in Java 7. In Java 6, getCompletedTaskCount did not include tasks which terminated by throwing a RuntimeException, but in Java 7 it does.

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=382688 and Re: ThreadPoolExecutor.getCompletedTaskCount changed behaviour in Java 7 for background.

How can I get the Java 7 compatibility page (http://www.oracle.com/technetwork/java/javase/compatibility-417013.html) updated to document this change in behaviour?
  • 1. Re: ThreadPoolExecutor behaviour change in Java 7
    798831 Newbie
    Currently Being Moderated
    As I wrote in the concurrency forum:

    This was a functional bug in 6 - 6450207. The notion of Task completion matches the semantics of Futures where completion is indicated by isDone() and signifies normal completion, exceptional completion or cancellation. This is also indicated elsewhere in the TPE docs eg see afterExecute.

    http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ThreadPoolExecutor.html#afterExecute(java.lang.Runnable,%20java.lang.Throwable)

    The question of whether this fix then warrants an entry in the compatibility notes is a tricky one. Naturally if this bug has surprised you, you see the change as an incompatibility and would like to see it documented. For others this is just a bug like a dozen others and they don't all need to be documented. I'm in the latter camp but sympathetic to the former. :) I will see how painful it is to make such changes.

    David Holmes
  • 2. Re: ThreadPoolExecutor behaviour change in Java 7
    950535 Newbie
    Currently Being Moderated
    Thanks David. Hopefully the facts that we had a testcase specifically checking for the changed behaviour and I took the trouble to report this perceived incompatibility should warrant updating the page.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points