code: public void completeExceptionally(Throwable ex) {
          setExceptionalCompletion((ex instanceof RuntimeException) ||
                                   (ex instanceof Error) ? ex :
                                   new RuntimeException(ex));
      }
docs: Completes this task abnormally, and if not already aborted or
  cancelled, causes it to throw the given exception upon
  {@code join} and related operations. This method may be used
  to induce exceptions in asynchronous tasks, or to force
  completion of tasks that would not otherwise complete.  Its use
  in other situations is discouraged.  This method is
  overridable, but overridden versions must invoke {@code super}
  implementation to maintain guarantees.
  
  @param ex the exception to throw. If this exception is not a
  {@code RuntimeException} or {@code Error}, the actual exception
  thrown will be a {@code RuntimeException} with cause {@code ex}.