docs: @FFDCIgnore(value = { InterruptedException.class, RejectedExecutionException.class }) // these are raised directly to invoker, who decides how to handle
      private boolean enqueue(PolicyTaskFutureImpl<?> policyTaskFuture, long wait, Boolean runIfQueueFullOverride) {
          boolean enqueued;
          try {
              boolean haveQueuePermit = maxQueueSizeConstraint.tryAcquire();
  
              if (!haveQueuePermit && state.get() == State.ACTIVE) {
                  long now = System.nanoTime(), nextTimeout = now; // means unset
                  long waitEnd = wait > 0 ? now + wait : now;
                  do {
                      // look for a timed-out task that can be purged to make room for this request
                      for (Iterator<PolicyTaskFutureImpl<?>> it = queue.iterator(); !haveQueuePermit && it.hasNext();) {
                          PolicyTaskFutureImpl<?> future = it.next();
                          long startBy = future.nsStartBy;
                          if (startBy != future.nsAcceptBegin - 1)
                              if (now - startBy >= 0) { // found a task in the queue that has timed out
                                  if (queue.remove(future)) { // can't use iterator.remove - it doesn't tell us whether it actually removed anything
                                      future.nsRunEnd = future.nsQueueEnd = System.nanoTime();
                                      future.abort(false, new StartTimeoutException(future.getIdentifier(), future.getTaskName(), //
                                                      future.nsQueueEnd - future.nsAcceptBegin, //
                                                      future.nsStartBy - future.nsAcceptBegin));
                                      // Release and re-acquire is needed to preserve correctness of shutdown logic
                                      maxQueueSizeConstraint.release();
                                      haveQueuePermit = maxQueueSizeConstraint.tryAcquire();
                                  } // else another thread removed it first, possibly to run it. Keep trying...
                              } else if (nextTimeout - startBy > 0 || nextTimeout == now)
                                  nextTimeout = startBy;
                      }
                      if (!haveQueuePermit) {
                          long remain = waitEnd - System.nanoTime();
                          if (remain > 0) {
                              // wait incrementally in smallest of: { remaining time, next expected timeout, 1 second }
                              long w = nextTimeout == now || nextTimeout - now > remain ? remain : nextTimeout - now;
                              w = w < TimeUnit.SECONDS.toNanos(1) ? w : TimeUnit.SECONDS.toNanos(1);
                              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                  Tr.debug(this, tc, "incremental wait for enqueue of " + w + "ns");
                              haveQueuePermit = maxQueueSizeConstraint.tryAcquire(w, TimeUnit.NANOSECONDS);
                              nextTimeout = now = System.nanoTime();
                          } else
                              break;
                      }
                  } while (!haveQueuePermit && waitEnd - now > 0);
              }
  
              if (haveQueuePermit) {
                  Callback callback = cbQueueSize.get();
                  if (callback != null
                      && maxQueueSizeConstraint.availablePermits() < callback.threshold
                      && cbQueueSize.compareAndSet(callback, null)) {
                      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                          Tr.debug(this, tc, "callback: queue capacity < " + callback.threshold, callback.runnable);
                      globalExecutor.submit(callback.runnable);
                  }
  
                  policyTaskFuture.accept(false);
                  enqueued = queue.offer(policyTaskFuture);
  
                  int w = withheldConcurrency.incrementAndGet();
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                      Tr.debug(this, tc, "withheld concurrency --> " + w);
                  if (maxConcurrencyConstraint.tryAcquire()) {
                      decrementWithheldConcurrency();
                      if (acquireExpedite() > 0)
                          expediteGlobal(new GlobalPoolTask());
                      else
                          enqueueGlobal(new GlobalPoolTask());
                  }
  
                  // Check if shutdown occurred since acquiring the permit to enqueue, and if so, try to remove the queued task
                  if (state.get() != State.ACTIVE && queue.remove(policyTaskFuture)) {
                      policyTaskFuture.nsRunEnd = policyTaskFuture.nsQueueEnd = System.nanoTime();
                      throw new RejectedExecutionException(Tr.formatMessage(tc, "CWWKE1202.submit.after.shutdown", policyTaskFuture.getIdentifier()));
                  }
              } else if (state.get() == State.ACTIVE) {
                  boolean haveConcurrencyPermit = false;
                  if (policyTaskFuture.nsStartBy != policyTaskFuture.nsAcceptBegin - 1 // start timeout enabled, and
                      && System.nanoTime() - policyTaskFuture.nsStartBy >= 0) // timed out per the startTimeout
                      throw new RejectedExecutionException(new StartTimeoutException( //
                                      policyTaskFuture.getIdentifier(), policyTaskFuture.getTaskName(), //
                                      policyTaskFuture.nsQueueEnd - policyTaskFuture.nsAcceptBegin, //
                                      policyTaskFuture.nsStartBy - policyTaskFuture.nsAcceptBegin));
                  else if (Boolean.TRUE.equals(runIfQueueFullOverride) ||
                           !Boolean.FALSE.equals(runIfQueueFullOverride) && runIfQueueFull
                                                                          && (maxPolicy == MaxPolicy.loose
                                                                              || (haveConcurrencyPermit = maxConcurrencyConstraint.tryAcquire())))
                      try {
                          policyTaskFuture.accept(true);
                          runTask(policyTaskFuture);
                          enqueued = false;
                      } finally {
                          if (haveConcurrencyPermit)
                              transferOrReleasePermit();
                      }
                  else
                      throw new RejectedExecutionException(Tr.formatMessage(tc, "CWWKE1201.queue.full.abort", policyTaskFuture.getIdentifier(), maxQueueSize, wait));
              } else
                  throw new RejectedExecutionException(Tr.formatMessage(tc, "CWWKE1202.submit.after.shutdown", policyTaskFuture.getIdentifier()));
          } catch (InterruptedException x) {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  Tr.debug(this, tc, "enqueue", x);
              policyTaskFuture.abort(false, x);
              throw new RejectedExecutionException(x);
          } catch (RejectedExecutionException x) { // redundant with RuntimeException code path, but added to allow FFDCIgnore
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  Tr.debug(this, tc, "enqueue", x);
              policyTaskFuture.abort(false, x);
              throw x;
          } catch (RuntimeException x) {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  Tr.debug(this, tc, "enqueue", x);
              policyTaskFuture.abort(true, x);
              throw x;
          } catch (Error x) {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  Tr.debug(this, tc, "enqueue", x);
              policyTaskFuture.abort(true, x);
              throw x;
          }
          return enqueued;
      }