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

ThreadPoolExecutor/Callable silently ignores all uncaught exception

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      All OS and JDK 1.5 to current JDK12.

      A DESCRIPTION OF THE PROBLEM :
      ThreadPoolExecutor/Callable silently ignore all uncaught exception unless Future.get() is called.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run code below.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Some output to indicate uncaught exception.
      ACTUAL -
      Silent ignore.

      ---------- BEGIN SOURCE ----------
      new ThreadPoolExecutor(1, 1, 2, TimeUnit.MINUTES, new LinkedBlockingDeque<Runnable>(10))
      .submit(new Callable<Object>() {

      @Override
      public Object call() throws Exception {
      throw new RuntimeException();
      }
      });

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Developer must remember to call Future.get(), otherwise threadpool silently ignore all uncaught exception.

      FREQUENCY : always


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: