Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7178766

Executor Service exceptions propagate to uncaught exception handler

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 7
    • core-libs

      A DESCRIPTION OF THE REQUEST :
      This RFE should be read in conjunction with bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7176957

      The issue is that exceptions thrown by runnable submitted to an executor service using the submit method instead of the execute method are set on the returned future, and are not passed to any uncaughtExceptionHandler that could be configured via the executorServices's thread-factory. If the returned future is not assigned/inspected, the exception could be lost... it has therefore not been handled by user code, or by the uncaughtExcetionHandler. The javaDoc enhancement described by http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7176957 should warn about this issue, but the resultant futureTask could also pass the exception to the uncaught exception handler in its finalize() method if the exception has not already been raised as an ExecutionException.

      JUSTIFICATION :
      This enhancement is necessary as lost diagnostic stack-traces can result in simple issues taking a long time to diagnose/fix.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Uncaught exceptions should be passed to uncaughtExceptionHandler
      ACTUAL -
      exception set on the future and then lost.

      ---------- BEGIN SOURCE ----------
      See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7176957
      ---------- END SOURCE ----------

            martin Martin Buchholz
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: