/** Deregister a pending Future that had a callback. */
  public static void removePending(Future<?> future) {
    Pending pend = pending.get();
    if (pend != null) {
      pend.remove(future);

      // When the last one is gone, we don't need this thread local anymore
      if (pend.isEmpty()) pending.remove();
    }
  }