docs: @Override
      @FFDCIgnore(value = { RejectedExecutionException.class })
      public <T> T invokeAny(Collection<? extends Callable<T>> tasks, PolicyTaskCallback[] callbacks) throws InterruptedException, ExecutionException {
          int taskCount = tasks.size();
  
          // Special case to run a single task on the current thread if we can acquire a permit, if a permit is required
          if (taskCount == 1) {
              boolean havePermit = false;
              if (maxPolicy == MaxPolicy.loose || (havePermit = maxConcurrencyConstraint.tryAcquire())) // use current thread
                  try {
                      if (state.get() != State.ACTIVE)
                          throw new RejectedExecutionException(Tr.formatMessage(tc, "CWWKE1202.submit.after.shutdown", identifier));
  
                      // startTimeout does not apply because the task starts immediately
                      PolicyTaskFutureImpl<T> taskFuture = new PolicyTaskFutureImpl<T>(this, tasks.iterator().next(), callbacks == null ? null : callbacks[0], -1);
                      taskFuture.accept(true);
                      runTask(taskFuture);
  
                      // raise InterruptedException if current thread is interrupted
                      taskFuture.throwIfInterrupted();
  
                      return taskFuture.get();
                  } finally {
                      if (havePermit)
                          transferOrReleasePermit();
                  }
          } else if (taskCount == 0)
              throw new IllegalArgumentException();
  
          InvokeAnyLatch latch = new InvokeAnyLatch(taskCount);
          ArrayList<PolicyTaskFutureImpl<T>> futures = new ArrayList<PolicyTaskFutureImpl<T>>(taskCount);
          try {
              // create futures in advance, which gives the callback an opportunity to reject
              int t = 0;
              for (Callable<T> task : tasks) {
                  PolicyTaskCallback callback = callbacks == null ? null : callbacks[t++];
                  PolicyExecutorImpl executor = callback == null ? this : (PolicyExecutorImpl) callback.getExecutor(this);
                  long startTimeoutNS = callback == null ? startTimeout : callback.getStartTimeout(executor.startTimeout);
                  futures.add(new PolicyTaskFutureImpl<T>(executor, task, callback, startTimeoutNS, latch));
              }
  
              // enqueue all tasks
              for (PolicyTaskFutureImpl<T> taskFuture : futures) {
                  // check if done before enqueuing more tasks
                  if (latch.getCount() == 0)
                      break;
  
                  taskFuture.executor.enqueue(taskFuture, taskFuture.executor.maxWaitForEnqueueNS.get(), false); // never run on the current thread because it would prevent timeout
              }
  
              // wait for completion
              return latch.await(-1, futures);
          } catch (RejectedExecutionException x) {
              if (x.getCause() instanceof InterruptedException) {
                  throw (InterruptedException) x.getCause();
              } else
                  throw x;
          } catch (TimeoutException x) {
              throw new RuntimeException(x); // should be unreachable with infinite timeout
          } finally {
              for (Future<?> f : futures)
                  f.cancel(true);
          }
      }